Class: Authorization::DevelopmentSupport::Analyzer::ProposedPrivilegeHierarchyAnalyzer
- Inherits:
-
GeneralRulesAnalyzer
- Object
- GeneralRulesAnalyzer
- Authorization::DevelopmentSupport::Analyzer::ProposedPrivilegeHierarchyAnalyzer
- Defined in:
- lib/declarative_authorization/development_support/analyzer.rb
Instance Method Summary collapse
-
#analyze_privilege(privilege) ⇒ Object
TODO respect, consider contexts.
- #message(privilege) ⇒ Object
Methods inherited from GeneralRulesAnalyzer
Constructor Details
This class inherits a constructor from Authorization::DevelopmentSupport::Analyzer::GeneralRulesAnalyzer
Instance Method Details
#analyze_privilege(privilege) ⇒ Object
TODO respect, consider contexts
128 129 130 131 132 133 |
# File 'lib/declarative_authorization/development_support/analyzer.rb', line 128 def analyze_privilege (privilege) privileges.find do |other_privilege| other_privilege != privilege and other_privilege.rules.all? {|rule| rule.privileges.include?(privilege)} end end |
#message(privilege) ⇒ Object
135 136 137 138 139 |
# File 'lib/declarative_authorization/development_support/analyzer.rb', line 135 def (privilege) other_privilege = analyze_privilege(privilege) "Privilege #{other_privilege.to_sym} is always used together with #{privilege.to_sym}. " + "Consider to include #{other_privilege.to_sym} in #{privilege.to_sym}." end |