mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 11:47:56 +01:00
Add users management to site settings (#126)
This commit is contained in:
committed by
GitHub
parent
bc15140512
commit
37fb99a868
@@ -1,12 +1,27 @@
|
||||
module ApplicationHelper
|
||||
def authenticate_admin
|
||||
def check_user_signed_in
|
||||
unless user_signed_in?
|
||||
flash[:alert] = t('backend.errors.not_logged_in')
|
||||
redirect_to new_user_session_path
|
||||
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def authenticate_admin
|
||||
return if check_user_signed_in == false
|
||||
|
||||
unless current_user.admin?
|
||||
flash[:alert] = t('backend.errors.not_enough_privileges')
|
||||
redirect_to root_path
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
unless current_user.moderator? || current_user.admin?
|
||||
def authenticate_power_user
|
||||
return if check_user_signed_in == false
|
||||
|
||||
unless current_user.admin? or current_user.moderator?
|
||||
flash[:alert] = t('backend.errors.not_enough_privileges')
|
||||
redirect_to root_path
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user