Class Authorization::DevelopmentSupport::ChangeSupporter::RemovePrivilegeFromRoleAction
In: lib/declarative_authorization/development_support/change_supporter.rb
Parent: AbstractAction

Methods

apply   new   reverse?   specific_actions   to_a  

Attributes

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

Public Class methods

[Source]

     # 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

[Source]

     # 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

Public Instance methods

[Source]

     # 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

[Source]

     # File lib/declarative_authorization/development_support/change_supporter.rb, line 480
480:         def reverse? (other)
481:           (other.is_a?(AssignPrivilegeToRoleAction) or
482:               other.is_a?(AbstractCompoundAction)) and
483:                 other.reverse?(self)
484:         end

[Source]

     # File lib/declarative_authorization/development_support/change_supporter.rb, line 486
486:         def to_a
487:           [:remove_privilege, @privilege, @context, @role]
488:         end

[Validate]