Exception: SecurityViolationError
- Inherits:
-
AnnotationSecurity::SecurityError
- Object
- StandardError
- AnnotationSecurity::SecurityError
- SecurityViolationError
- Defined in:
- lib/annotation_security/exceptions.rb
Overview
Exception indicating that some rights were violated.
Class Method Summary collapse
-
.access_denied(user, *args) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#action ⇒ Object
the action that should have been performed on the resource object.
-
#initialize(user = nil, *args) ⇒ SecurityViolationError
constructor
:nodoc:.
-
#load_args(user, args) ⇒ Object
:nodoc:.
-
#resource ⇒ Object
the resource that was accessed.
-
#resource_class ⇒ Object
the resource type.
-
#user ⇒ Object
user that violated the right.
Constructor Details
#initialize(user = nil, *args) ⇒ SecurityViolationError
:nodoc:
22 23 24 25 26 27 28 |
# File 'lib/annotation_security/exceptions.rb', line 22 def initialize(user=nil,*args) # :nodoc: if user == nil || args.empty? super "Access denied" else super load_args(user,args) end end |
Class Method Details
.access_denied(user, *args) ⇒ Object
:nodoc:
18 19 20 |
# File 'lib/annotation_security/exceptions.rb', line 18 def self.access_denied(user,*args) # :nodoc: new(user,*args) end |
Instance Method Details
#action ⇒ Object
the action that should have been performed on the resource object
45 46 47 |
# File 'lib/annotation_security/exceptions.rb', line 45 def action @action end |
#load_args(user, args) ⇒ Object
:nodoc:
30 31 32 33 34 35 |
# File 'lib/annotation_security/exceptions.rb', line 30 def load_args(user,args) # :nodoc: @user = user @action,@resclass,@res = AnnotationSecurity::Utils.parse_policy_arguments(args) "You (#@user) are missing the right '#@action' for #@resclass" + (@res.blank? ? '' : " '#@res'") end |
#resource ⇒ Object
the resource that was accessed
57 58 59 |
# File 'lib/annotation_security/exceptions.rb', line 57 def resource @res end |
#resource_class ⇒ Object
the resource type
51 52 53 |
# File 'lib/annotation_security/exceptions.rb', line 51 def resource_class @resclass end |
#user ⇒ Object
user that violated the right
39 40 41 |
# File 'lib/annotation_security/exceptions.rb', line 39 def user @user end |