lib/rbacan.rb in rbacan-0.1.0 vs lib/rbacan.rb in rbacan-0.1.1

- old
+ new

@@ -3,13 +3,11 @@ require 'rbacan/engine' require "rbacan/roles_and_permissions" module Rbacan mattr_accessor :permittable_class - # mattr_accessor :permittable_table @@permittable_class = 'User' - # @@permittable_table = @@permittable_class.tableize mattr_accessor :role_class mattr_accessor :role_table @@role_class = 'Rbacan::Role' @@role_table = 'roles' @@ -41,17 +39,21 @@ chosen_role = @@role_class.find_by_name(role_name) given_permission = @@permission_class.find_by_name(permission_name) @@role_permission_class.create(role_id: chosen_role.id, perm_id: given_permission.id) end - def assign_role_to_user(role_name) + def assign_role(role_name) assigned_role = Role.find_by_name(role_name) @@user_role_class.create(user_id: self.id, role_id: assigned_role.id) end def remove_user_role(role_name) removed_role = Role.find_by_name(role_name) @@user_role_class.where(user_id: self.id, role_id: removed_role.id).destroy_all + end + + def self.configure(&block) + yield self end class Error < StandardError; end # Your code goes here... end