@ -251,7 +251,11 @@ class User_Role_relation < EntityModel
end
def self.revoke_role(user_id, role_id)
# TODO: revoke role
user = User.find_by_id user_id
if user.role_ids.include?(role_id) then
self.delete "role_id = ? AND user_id = ?", role_id, user_id
def self.get_user_roles_ids(user_id)
@ -86,8 +86,8 @@ class EntityModel
return newid, resp
def self.delete(id)
self.query "DELETE FROM #{self.name} WHERE id = ?", id
def self.delete(filter="", *args)
self.query "DELETE FROM #{self.name} #{self.apply_filter(filter)}", *args
def self.set(attr, data, filter="") # slower but more lazy