forked from External/greenlight
GRN2-176: Create a role editor that allows admins to specify what permissions each role has (#709)
* Add roles editor * Add colour selection ability to roles * Add ability to assign roles to users in the UI * Remove rolify and replace it with our own custom roles implemenation * - Fix all existing roles functionality - Fix super admins * Fix bugs with new customers not have default roles * Add can't create room setting * Code improvements * Fix migration * Add tests for new methods * Translate reserved role names * Pull roles from saml/ldap * Fix rspec * Fix scrutinizer issues * Fix email promoted/demoted tests * Apply comments * Redirect directly to the main room * Add comments
This commit is contained in:
committed by
Jesus Federico
parent
02b342b157
commit
4fc1714db8
@ -137,7 +137,7 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
# Checks to make sure that the admin has changed his password from the default
|
||||
def check_admin_password
|
||||
if current_user&.has_cached_role?(:admin) && current_user&.greenlight_account? &&
|
||||
if current_user&.has_role?(:admin) && current_user&.greenlight_account? &&
|
||||
current_user&.authenticate(Rails.configuration.admin_password_default)
|
||||
|
||||
flash.now[:alert] = I18n.t("default_admin",
|
||||
@ -185,10 +185,10 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
# Checks if the user is banned and logs him out if he is
|
||||
def check_user_role
|
||||
if current_user&.has_cached_role? :denied
|
||||
if current_user&.has_role? :denied
|
||||
session.delete(:user_id)
|
||||
redirect_to root_path, flash: { alert: I18n.t("registration.banned.fail") }
|
||||
elsif current_user&.has_cached_role? :pending
|
||||
elsif current_user&.has_role? :pending
|
||||
session.delete(:user_id)
|
||||
redirect_to root_path, flash: { alert: I18n.t("registration.approval.fail") }
|
||||
end
|
||||
|
Reference in New Issue
Block a user