Class: Mxrb::Runtime::SecurityContext
- Inherits:
-
Object
- Object
- Mxrb::Runtime::SecurityContext
- Defined in:
- lib/mxrb/runtime/access_control.rb
Overview
Explicit security context used by the pure-Ruby runtime. User roles are expanded to module roles by AccessControl; callers may also supply module roles directly for system-to-system execution.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#module_roles ⇒ Object
readonly
Returns the value of attribute module_roles.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#user_roles ⇒ Object
readonly
Returns the value of attribute user_roles.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Instance Method Summary collapse
-
#initialize(user: nil, roles: [], user_roles: nil, module_roles: [], attributes: {}, variables: {}) ⇒ SecurityContext
constructor
A new instance of SecurityContext.
- #roles ⇒ Object
Constructor Details
#initialize(user: nil, roles: [], user_roles: nil, module_roles: [], attributes: {}, variables: {}) ⇒ SecurityContext
Returns a new instance of SecurityContext.
20 21 22 23 24 25 26 27 |
# File 'lib/mxrb/runtime/access_control.rb', line 20 def initialize(user: nil, roles: [], user_roles: nil, module_roles: [], attributes: {}, variables: {}) @user = user @user_roles = strings(user_roles || roles) @module_roles = strings(module_roles) @attributes = attributes.to_h.freeze @variables = variables.to_h.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
18 19 20 |
# File 'lib/mxrb/runtime/access_control.rb', line 18 def attributes @attributes end |
#module_roles ⇒ Object (readonly)
Returns the value of attribute module_roles.
18 19 20 |
# File 'lib/mxrb/runtime/access_control.rb', line 18 def module_roles @module_roles end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
18 19 20 |
# File 'lib/mxrb/runtime/access_control.rb', line 18 def user @user end |
#user_roles ⇒ Object (readonly)
Returns the value of attribute user_roles.
18 19 20 |
# File 'lib/mxrb/runtime/access_control.rb', line 18 def user_roles @user_roles end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
18 19 20 |
# File 'lib/mxrb/runtime/access_control.rb', line 18 def variables @variables end |
Instance Method Details
#roles ⇒ Object
29 |
# File 'lib/mxrb/runtime/access_control.rb', line 29 def roles = @user_roles |