add notification settings, fix comment edit permissions

This commit is contained in:
jomo
2014-06-17 21:19:15 +02:00
parent 2564ea1aa6
commit 8a7d719920
9 changed files with 114 additions and 38 deletions

View File

@@ -204,6 +204,14 @@ class UsersController < ApplicationController
end
end
def edit_notifications
@user = User.find(params[:id])
unless @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin?
flash[:alert] = "You are not allowed to edit this user's notification settings!"
redirect_to @user
end
end
def edit_login
@user = User.find(params[:id])
unless @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin?
@@ -267,7 +275,7 @@ class UsersController < ApplicationController
end
def user_params(add = [])
a = [:ign, :email, :password, :password_confirmation] + add
a = [:ign, :email, :password, :password_confirmation, :mail_own_thread_reply, :mail_other_thread_reply, :mail_own_blogpost_comment, :mail_other_blogpost_comment, :mail_mention] + add
params.require(:user).permit(a)
end
end