|
|
@ -294,16 +294,16 @@ post "/admin/roles/give" do |
|
|
|
user = get_current_user |
|
|
|
user = get_current_user |
|
|
|
auth_denied if user.permitted? :roleman |
|
|
|
auth_denied if user.permitted? :roleman |
|
|
|
|
|
|
|
|
|
|
|
user_id = params[:user_id] |
|
|
|
user_id = params[:user_id].to_i |
|
|
|
role_id = params[:role_id] |
|
|
|
role_id = params[:role_id].to_i |
|
|
|
|
|
|
|
|
|
|
|
if user.role_ids.include? role_id or user.admin? then |
|
|
|
if user.role_ids.include?(role_id) or user.admin? then |
|
|
|
User_Role_relation.give_role(user_id, role_id) |
|
|
|
resp = User_Role_relation.give_role(user_id, role_id) |
|
|
|
|
|
|
|
|
|
|
|
newrole = Role.find_by_id role_id |
|
|
|
newrole = Role.find_by_id role_id |
|
|
|
promoted_user = User.find_by_id user_id |
|
|
|
promoted_user = User.find_by_id user_id |
|
|
|
|
|
|
|
|
|
|
|
flash[:success] = "Gave role '#{newrole.name}' to #{promoted_user.name}!" |
|
|
|
flash[:success] = "Gave role '#{newrole.name}' to #{promoted_user.name}!" if resp |
|
|
|
redirect "/admin" |
|
|
|
redirect "/admin" |
|
|
|
else |
|
|
|
else |
|
|
|
auth_denied "You are not permitted to give that role!", 403, "/admin" |
|
|
|
auth_denied "You are not permitted to give that role!", 403, "/admin" |
|
|
|