lib/access-granted/policy.rb in access-granted-1.3.1 vs lib/access-granted/policy.rb in access-granted-1.3.3
- old
+ new
@@ -54,17 +54,15 @@
def cannot?(*args)
!can?(*args)
end
- def authorize!(action, subject)
+ def authorize!(action, subject, message = 'Access Denied')
if cannot?(action, subject)
- raise AccessDenied.new(action, subject)
+ raise AccessDenied.new(action, subject, message)
end
subject
end
-
- private
def applicable_roles
@applicable_roles ||= roles.select do |role|
role.applies_to?(user)
end