Sha256: 39ae8aea78fa4d9e10b69930936912b8a1ce82040f4eb60a1718edcb05e771bb
Contents?: true
Size: 820 Bytes
Versions: 3
Compression:
Stored size: 820 Bytes
Contents
module Rbacan module RolesAndPermissions attr_reader :test_method def self.create_roles(roles) roles.each do |role| Rbacan::Role.create(name: role) end end def self.create_permissions(permissions) permissions.each do |permission| Rbacan::Permission.create(name: permission) end end def self.assign_permissions_to_role(role_name, permissions) chosen_role = Rbacan::Role.find_by_name(role_name) permissions.each do |permission| given_permission = Rbacan::Permission.find_by_name(permission) Rbacan::RolePermission.create(role_id: chosen_role.id, permission_id: given_permission.id) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rbacan-0.1.2 | lib/rbacan/roles_and_permissions.rb |
rbacan-0.1.1 | lib/rbacan/roles_and_permissions.rb |
rbacan-0.1.0 | lib/rbacan/roles_and_permissions.rb |