Class: Unidom::Authorization::Authorizing
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Unidom::Authorization::Authorizing
- Includes:
- Common::Concerns::ModelExtension
- Defined in:
- app/models/unidom/authorization/authorizing.rb
Overview
Authorizing 是授权。
Class Method Summary collapse
Class Method Details
.authorize!(permission: nil, authorized: nil, authorizer: nil, opened_at: Time.now) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/models/unidom/authorization/authorizing.rb', line 22 def self.(permission: nil, authorized: nil, authorizer: nil, opened_at: Time.now) assert_present! :permission, assert_present! :authorized, assert_present! :opened_at, opened_at attributes = { opened_at: opened_at } if .present? attributes[:authorizer] = else attributes[:authorizer_id] = Unidom::Common::NULL_UUID attributes[:authorizer_type] = '' end self.().().valid_at.alive.first_or_create! attributes end |