Class Authorization::DevelopmentSupport::ChangeSupporter::AddPrivilegeAndAssignRoleToUserAction
In: lib/declarative_authorization/development_support/change_supporter.rb
Parent: AbstractCompoundAction

Methods

Attributes

context  [R] 
privilege  [R] 
role  [R] 
user  [R] 

Public Class methods

[Source]

     # File lib/declarative_authorization/development_support/change_supporter.rb, line 448
448:         def initialize (user, privilege_sym, context, role_sym)
449:           @user, @privilege, @context, @role = user, privilege_sym, context, role_sym
450:           @actions = [
451:             AssignRoleToUserAction.new(@user, @role),
452:             AssignPrivilegeToRoleAction.new(@privilege, @context, @role)
453:           ]
454:         end

[Source]

     # File lib/declarative_authorization/development_support/change_supporter.rb, line 435
435:         def self.specific_actions (candidate)
436:           privilege = AnalyzerEngine::Privilege.for_sym(
437:               candidate.failed_tests.first.privilege, candidate.engine)
438:           context = candidate.failed_tests.first.context
439:           user = candidate.failed_tests.first.user
440:           ([privilege] + privilege.ancestors).collect do |ancestor_privilege|
441:             AnalyzerEngine::Role.all(candidate.engine).collect do |role|
442:               new(user, ancestor_privilege.to_sym, context, role.to_sym)
443:             end
444:           end.flatten
445:         end

[Validate]