This commit is contained in:
Vokhmin Alexey V 2015-03-20 02:55:50 +03:00
parent a69b03b88c
commit 9c0996a3c5
2 changed files with 3 additions and 3 deletions

View File

@ -47,7 +47,7 @@ class ApplicationController < ActionController::Base
# Disables access to site for banned users # Disables access to site for banned users
def banned? def banned?
if user_signed_in? && current_user.is_banned? if user_signed_in? && current_user.access_locked?
sign_out current_user sign_out current_user
flash[:error] = I18n.t('devise.failure.locked') flash[:error] = I18n.t('devise.failure.locked')
redirect_to root_path redirect_to root_path

View File

@ -125,14 +125,14 @@ class ApplicationPolicy
# #
# Returns true if he is, false otherwise. # Returns true if he is, false otherwise.
def local_reader?(r = record) def local_reader?(r = record)
owner?(r) || %w(reader writer admin).include? best_role(r) owner?(r) || %w(reader writer admin).include?(best_role(r))
end end
# Private: Check if provided user is at least record writer. # Private: Check if provided user is at least record writer.
# #
# Returns true if he is, false otherwise. # Returns true if he is, false otherwise.
def local_writer?(r = record) def local_writer?(r = record)
owner?(r) || %w(writer admin).include? best_role(r) owner?(r) || %w(writer admin).include?(best_role(r))
end end
# Private: Check if provided user is record owner. # Private: Check if provided user is record owner.