Class: Ability::ToolResourceType
- Inherits:
-
Permission::ResourceType
- Object
- Permission::ResourceType
- Ability::ToolResourceType
- Defined in:
- app/models/ability.rb
Overview
Instance Method Summary collapse
- #actions ⇒ Object
- #compare(resource_object, resource_name) ⇒ Object
-
#initialize ⇒ ToolResourceType
constructor
A new instance of ToolResourceType.
Methods inherited from Permission::ResourceType
#add_ability, for_class, #has_resource_list?, #resources, #role_can?, #roles_can?, #roles_permissions
Constructor Details
#initialize ⇒ ToolResourceType
Returns a new instance of ToolResourceType.
160 161 162 |
# File 'app/models/ability.rb', line 160 def initialize super(Tool, 'Tool') end |
Instance Method Details
#actions ⇒ Object
164 165 166 167 168 |
# File 'app/models/ability.rb', line 164 def actions [ :show #Tool access ] end |
#compare(resource_object, resource_name) ⇒ Object
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'app/models/ability.rb', line 170 def compare(resource_object, resource_name) topic, attribute = resource_name.split('/') if topic == '*' if attribute == '*' true else resource_object.name == attribute end else if attribute == '*' resource_object.topic.name == topic else resource_object.name == attribute && resource_object.topic.name == topic end end end |