Module: Rbacan::RolesAndPermissions
- Defined in:
- lib/rbacan/roles_and_permissions.rb
Instance Attribute Summary collapse
-
#test_method ⇒ Object
readonly
Returns the value of attribute test_method.
Class Method Summary collapse
- .assign_permissions_to_role(role_name, permissions) ⇒ Object
- .create_permissions(permissions) ⇒ Object
- .create_roles(roles) ⇒ Object
Instance Attribute Details
#test_method ⇒ Object (readonly)
Returns the value of attribute test_method.
4 5 6 |
# File 'lib/rbacan/roles_and_permissions.rb', line 4 def test_method @test_method end |
Class Method Details
.assign_permissions_to_role(role_name, permissions) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/rbacan/roles_and_permissions.rb', line 18 def self.(role_name, ) chosen_role = Rbacan::Role.find_by_name(role_name) .each do || = Rbacan::Permission.find_by_name() Rbacan::RolePermission.create(role_id: chosen_role.id, permission_id: .id) end end |
.create_permissions(permissions) ⇒ Object
12 13 14 15 16 |
# File 'lib/rbacan/roles_and_permissions.rb', line 12 def self.() .each do || Rbacan::Permission.create(name: ) end end |