master
E. Almqvist 3 years ago
parent 4b762ca4a2
commit 2c89cafc15
  1. 6
      src/db_models.rb

@ -18,9 +18,6 @@ class User < EntityModel
end end
def role def role
p "######################"
p roles
p "######################"
if roles.length > 0 then if roles.length > 0 then
role = roles.max_by { |role| role.flags } role = roles.max_by { |role| role.flags }
return role.name return role.name
@ -150,11 +147,8 @@ end
class User_Role_relation < EntityModel class User_Role_relation < EntityModel
def self.get_user_roles(user_id) def self.get_user_roles(user_id)
roleids = self.get "role_id", "user_id = ?", user_id roleids = self.get "role_id", "user_id = ?", user_id
p roleids
roles = roleids.map do |ent| roles = roleids.map do |ent|
Role.find_by_id(ent["role_id"].to_i) Role.find_by_id(ent["role_id"].to_i)
end end
p roles
return roles
end end
end end

Loading…
Cancel
Save