Module: Authz::Models::Rolable

Extended by:
ActiveSupport::Concern
Defined in:
lib/authz/models/rolable.rb

Instance Method Summary collapse

Instance Method Details

#authz_labelObject

Mixed instance methods

Label used to label each rolable instance in the context of Authz



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/authz/models/rolable.rb', line 45

def authz_label
  if respond_to? :name
    name
  elsif respond_to? :email
    email
  elsif respond_to? :id
    "#{self.to_s}##{id}"
  else
    to_s
  end
end

#roles_cache_keyObject

Returns a composite cache key using the keys of the granted roles. The key will be modified when the configuration of any of the granted roles changes.



60
61
62
# File 'lib/authz/models/rolable.rb', line 60

def roles_cache_key
  roles.map(&:cache_key).join('/')
end