Class: Authorization::DevelopmentSupport::ChangeSupporter::AddPrivilegeAndAssignRoleToUserAction
- Inherits:
-
AbstractCompoundAction
- Object
- AbstractAction
- AbstractCompoundAction
- Authorization::DevelopmentSupport::ChangeSupporter::AddPrivilegeAndAssignRoleToUserAction
- Defined in:
- lib/declarative_authorization/development_support/change_supporter.rb
Instance Attribute Summary (collapse)
-
- (Object) context
readonly
Returns the value of attribute context.
-
- (Object) privilege
readonly
Returns the value of attribute privilege.
-
- (Object) role
readonly
Returns the value of attribute role.
-
- (Object) user
readonly
Returns the value of attribute user.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (AddPrivilegeAndAssignRoleToUserAction) initialize(user, privilege_sym, context, role_sym)
constructor
A new instance of AddPrivilegeAndAssignRoleToUserAction.
Methods inherited from AbstractCompoundAction
#apply, #hash, #resembles?, #reverse?, #to_a, #weight
Methods inherited from AbstractAction
#apply, #eql?, #hash, #inspect, readable_info, #resembles?, #resembles_any?, #reverse?, #to_a, #weight
Constructor Details
- (AddPrivilegeAndAssignRoleToUserAction) initialize(user, privilege_sym, context, role_sym)
A new instance of AddPrivilegeAndAssignRoleToUserAction
448 449 450 451 452 453 454 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 448 def initialize (user, privilege_sym, context, role_sym) @user, @privilege, @context, @role = user, privilege_sym, context, role_sym @actions = [ AssignRoleToUserAction.new(@user, @role), AssignPrivilegeToRoleAction.new(@privilege, @context, @role) ] end |
Instance Attribute Details
- (Object) context (readonly)
Returns the value of attribute context
447 448 449 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 447 def context @context end |
- (Object) privilege (readonly)
Returns the value of attribute privilege
447 448 449 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 447 def privilege @privilege end |
- (Object) role (readonly)
Returns the value of attribute role
447 448 449 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 447 def role @role end |
- (Object) user (readonly)
Returns the value of attribute user
447 448 449 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 447 def user @user end |
Class Method Details
+ (Object) specific_actions(candidate)
435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/declarative_authorization/development_support/change_supporter.rb', line 435 def self.specific_actions (candidate) privilege = AnalyzerEngine::Privilege.for_sym( candidate.failed_tests.first.privilege, candidate.engine) context = candidate.failed_tests.first.context user = candidate.failed_tests.first.user ([privilege] + privilege.ancestors).collect do |ancestor_privilege| AnalyzerEngine::Role.all(candidate.engine).collect do |role| new(user, ancestor_privilege.to_sym, context, role.to_sym) end end.flatten end |