master
E. Almqvist 3 years ago
parent b368754794
commit 59944b107c
  1. 2
      src/app.rb
  2. 12
      src/db_models.rb

@ -239,6 +239,8 @@ end
# ADMIN USER MANAGEMENT
get "/admin/users/:id/ban" do
auth_denied unless get_current_user.admin?
id = params[:id].to_i
end
# ADMIN ROLE MANAGEMENT

@ -171,6 +171,14 @@ class User < EntityModel
def banned?
return self.flags[ PERM_LEVELS.keys.index(:banned) ] == 1
end
def banned=(b)
if b then
resp = User_Role_relation.give_role(@id, ROLE_IDS[:banned])
else
end
end
end
# Role model
@ -242,6 +250,10 @@ class User_Role_relation < EntityModel
end
end
def self.revoke_role(user_id, role_id)
# TODO: revoke role
end
def self.get_user_roles_ids(user_id)
ids = self.get "role_id", "user_id = ?", user_id
ids.map! do |ent|

Loading…
Cancel
Save