Sha256: b90c868cf90ef77e5d40e991e0c468a67aacfb2b8ce24d8c3d7c2f36b6684edd
Contents?: true
Size: 505 Bytes
Versions: 1
Compression:
Stored size: 505 Bytes
Contents
module RightOn module RoleModel def self.included(base) base.module_eval 'has_and_belongs_to_many :roles, :class_name => "RightOn::Role"' Role.module_eval "has_and_belongs_to_many :#{base.table_name}" end def rights @rights ||= Right .select('distinct rights.*') .joins(:roles) .where('rights_roles.role_id IN (?)', role_ids) end def has_privileges_of?(other_user) (other_user.rights - rights).empty? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
right_on-0.3.0 | lib/right_on/role_model.rb |