Sha256: ec75e31e872ba07384bc27a2a2b8b39e8ddd7384c535496d042a1c6d026af4fa
Contents?: true
Size: 619 Bytes
Versions: 2
Compression:
Stored size: 619 Bytes
Contents
module Unidom::Authorization::Concerns::AsAuthorized extend ActiveSupport::Concern self.included do |includer| has_many :authorizings, class_name: 'Unidom::Authorization::Authorizing', as: :authorized has_many :permissions, through: :authorizings, source: :permission def is_authorized!(permission: nil, by: nil, at: Time.now) authorizings.create! permission: permission, authorizer: by, opened_at: at end def is_authorized?(permission: nil, at: Time.now) authorizings.permission_is(permission).valid_at(now: at).alive.exists? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
unidom-authorization-1.2.1 | app/models/unidom/authorization/concerns/as_authorized.rb |
unidom-authorization-1.2 | app/models/unidom/authorization/concerns/as_authorized.rb |