| Class | Authorization::DevelopmentSupport::ChangeSupporter::RemovePrivilegeFromRoleAction |
| In: |
lib/declarative_authorization/development_support/change_supporter.rb
|
| Parent: | AbstractAction |
| context | [R] | |
| privilege | [R] | |
| role | [R] |
# File lib/declarative_authorization/development_support/change_supporter.rb, line 472
472: def initialize (privilege_sym, context, role_sym)
473: @privilege, @context, @role = privilege_sym, context, role_sym
474: end
# File lib/declarative_authorization/development_support/change_supporter.rb, line 458
458: def self.specific_actions (candidate)
459: privilege = AnalyzerEngine::Privilege.for_sym(
460: candidate.failed_tests.first.privilege, candidate.engine)
461: context = candidate.failed_tests.first.context
462: user = candidate.failed_tests.first.user
463: ([privilege] + privilege.ancestors).collect do |ancestor_privilege|
464: user.role_symbols.collect {|role_sym| AnalyzerEngine::Role.for_sym(role_sym, candidate.engine) }.
465: collect {|role| [role] + role.ancestors}.flatten.uniq.collect do |role|
466: new(ancestor_privilege.to_sym, context, role.to_sym)
467: end
468: end.flatten
469: end
# File lib/declarative_authorization/development_support/change_supporter.rb, line 476
476: def apply (candidate)
477: AnalyzerEngine.apply_change(candidate.engine, to_a)
478: end