Module: Authorization::ObjectRolesTable::ModelExtensions::InstanceMethods

Defined in:
lib/rails-authorization-plugin/lib/publishare/object_roles_table.rb

Instance Method Summary collapse

Instance Method Details

#accepted_roles_by(user) ⇒ Object


187
188
189
# File 'lib/rails-authorization-plugin/lib/publishare/object_roles_table.rb', line 187

def accepted_roles_by(user)
  user.roles_for self
end

#accepts_no_role(role_name, user) ⇒ Object


178
179
180
# File 'lib/rails-authorization-plugin/lib/publishare/object_roles_table.rb', line 178

def accepts_no_role(role_name, user)
  user.has_no_role role_name, self
end

#accepts_role(role_name, user) ⇒ Object


174
175
176
# File 'lib/rails-authorization-plugin/lib/publishare/object_roles_table.rb', line 174

def accepts_role(role_name, user)
  user.has_role role_name, self
end

#accepts_role?(role_name, user) ⇒ Boolean

If roles aren't overriden in model then check roles table

Returns:

  • (Boolean)

170
171
172
# File 'lib/rails-authorization-plugin/lib/publishare/object_roles_table.rb', line 170

def accepts_role?(role_name, user)
  user.has_role? role_name, self
end

#accepts_roles_by?(user) ⇒ Boolean Also known as: accepts_role_by?

Returns:

  • (Boolean)

182
183
184
# File 'lib/rails-authorization-plugin/lib/publishare/object_roles_table.rb', line 182

def accepts_roles_by?(user)
  user.has_roles_for? self
end