Module: Authorule::PermissionHolder
- Extended by:
- ActiveSupport::Concern
- Includes:
- PermissionAccessors
- Defined in:
- lib/authorule/permission_holder.rb
Overview
Makes any ActiveModel/ActiveRecord-like class a UI permission holder.
Usage
class User
include Authorule::PermissionHolder
end
-
A (has many)
permission_rulesassociation is added to the model (though the name may be changed in the is_permission_holder! method). -
A Authorule::PermissionAccessors#may? and Authorule::PermissionAccessors#may_not? method is added.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#has_permission?(permission) ⇒ Boolean
Determines whether this holder has the given permission by running it through his rule base.
Methods included from PermissionAccessors
#may?, #may_access?, #may_not?, #may_not_access?
Instance Method Details
#has_permission?(permission) ⇒ Boolean
Determines whether this holder has the given permission by running it through his rule base.
45 46 47 48 49 50 51 |
# File 'lib/authorule/permission_holder.rb', line 45 def () unless respond_to?(:permission_rule_base) raise "class not set up as permission holder, call is_permission_holder! first" end .run end |