class Authorization::DevelopmentSupport::ChangeSupporter::CreateAndAssignRoleToUserAction
Attributes
context[R]
privilege[R]
role[R]
user[R]
Public Class Methods
new(user, privilege_sym, context_sym, role_sym)
click to toggle source
# File lib/declarative_authorization/development_support/change_supporter.rb, line 412 def initialize (user, privilege_sym, context_sym, role_sym) @user, @privilege, @context, @role = user, privilege_sym, context_sym, role_sym @actions = [AddPrivilegeAndAssignRoleToUserAction.new(@user, @privilege, @context, role_sym)] end
specific_actions(candidate)
click to toggle source
# File lib/declarative_authorization/development_support/change_supporter.rb, line 400 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 role = AnalyzerEngine::Role.for_sym(:change_supporter_new_role, candidate.engine) ([privilege] + privilege.ancestors).collect do |ancestor_privilege| new(user, ancestor_privilege.to_sym, context, role.to_sym) end end
Public Instance Methods
apply(candidate)
click to toggle source
Calls superclass method
Authorization::DevelopmentSupport::ChangeSupporter::AbstractCompoundAction#apply
# File lib/declarative_authorization/development_support/change_supporter.rb, line 417 def apply (candidate) if AnalyzerEngine.apply_change(candidate.engine, [:add_role, @role]) super(candidate) else false end end
hash()
click to toggle source
Calls superclass method
Authorization::DevelopmentSupport::ChangeSupporter::AbstractCompoundAction#hash
# File lib/declarative_authorization/development_support/change_supporter.rb, line 425 def hash to_a[0].hash + super end
to_a()
click to toggle source
Calls superclass method
Authorization::DevelopmentSupport::ChangeSupporter::AbstractCompoundAction#to_a
# File lib/declarative_authorization/development_support/change_supporter.rb, line 429 def to_a [[:add_role, @role]] + super end