Class: Edgar::ModelPermission
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Edgar::ModelPermission
- Defined in:
- app/models/edgar/model_permission.rb
Overview
Model-wide CRUD permission for role. In other words, CRUD permission for each model for each role is defined by this.
This permission is used for two purposes:
-
page access permission
-
If this object,which relates to a model by model-attribute, exists and user belongs to the role (= user-group), then the controller, which 'model_class' method returns the model, can be accessed.
-
-
popup access permission
-
Popup access for a model-class is an read-permission for that.
-
Example:
-
User 'u' belongs to 'x-role' Edgar::UserGroup.
-
x-role has author model permission.
-
User 'u' can access AuthorController page.
-
If x-role has READ permission on author model, then user 'u' can see author-popup on any 'belongs_to' related page (e.g. BookController book form's author-popup).
Defined Under Namespace
Modules: FlagsBitset
Constant Summary
- FLAGS_ALL =
FlagsBitset.constants.inject(0){|sum, flag| sum += FlagsBitset.const_get(flag) }
Instance Method Summary (collapse)
-
- (Boolean) permitted?(requested_flags)
return true if ALL requested flags are included in flags.
Instance Method Details
- (Boolean) permitted?(requested_flags)
return true if ALL requested flags are included in flags
37 38 39 |
# File 'app/models/edgar/model_permission.rb', line 37 def permitted?(requested_flags) (self.flags & requested_flags) == requested_flags end |