lib/gds-sso/controller_methods.rb in gds-sso-15.0.0 vs lib/gds-sso/controller_methods.rb in gds-sso-15.0.1
- old
+ new
@@ -17,11 +17,10 @@
base.helper_method :user_signed_in?
base.helper_method :current_user
end
end
-
def authorise_user!(permissions)
# Ensure that we're authenticated (and by extension that current_user is set).
# Otherwise current_user might be nil, and we'd error out
authenticate_user!
@@ -50,11 +49,11 @@
def user_remotely_signed_out?
warden && warden.authenticated? && warden.user.remotely_signed_out?
end
def user_signed_in?
- warden && warden.authenticated? && ! warden.user.remotely_signed_out?
+ warden && warden.authenticated? && !warden.user.remotely_signed_out?
end
def current_user
warden.user if user_signed_in?
end
@@ -62,25 +61,25 @@
def logout
warden.logout
end
def warden
- request.env['warden']
+ request.env["warden"]
end
- private
+ private
def authorise_user_with_at_least_one_of_permissions!(permissions)
if permissions.none? { |permission| current_user.has_permission?(permission) }
raise PermissionDeniedException,
- "Sorry, you don't seem to have any of the permissions: #{permissions.to_sentence} for this app."
+ "Sorry, you don't seem to have any of the permissions: #{permissions.to_sentence} for this app."
end
end
def authorise_user_with_all_permissions!(permissions)
unless permissions.all? { |permission| current_user.has_permission?(permission) }
raise PermissionDeniedException,
- "Sorry, you don't seem to have all of the permissions: #{permissions.to_sentence} for this app."
+ "Sorry, you don't seem to have all of the permissions: #{permissions.to_sentence} for this app."
end
end
end
end
end