Class: Authorization::DevelopmentSupport::Analyzer

Inherits:
AbstractAnalyzer show all
Defined in:
lib/declarative_authorization/development_support/analyzer.rb

Overview

Ideas for improvement

  • moving rules up in the role hierarchy

  • merging roles

  • role hierarchy

Merge-able Rules: respect if_permitted_to hash

Defined Under Namespace

Classes: GeneralAuthorizationProcessor, GeneralRulesAnalyzer, InheritingPrivilegesAnalyzer, MergeableRulesProcessor, ProposedPrivilegeHierarchyAnalyzer, Report, RoleExplosionAnalyzer

Instance Attribute Summary

Attributes inherited from AbstractAnalyzer

#engine

Instance Method Summary (collapse)

Methods inherited from AbstractAnalyzer

#initialize, #roles, #rules

Constructor Details

This class inherits a constructor from Authorization::DevelopmentSupport::AbstractAnalyzer

Instance Method Details

- (Object) analyze(rules)



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/declarative_authorization/development_support/analyzer.rb', line 24

def analyze (rules)
  sexp_array = RubyParser.new.parse(rules)
  #sexp_array = ParseTree.translate(rules)
  @reports = []
  [MergeableRulesProcessor].each do |parser|
    parser.new(self).analyze(sexp_array)
  end
  [
    RoleExplosionAnalyzer, InheritingPrivilegesAnalyzer,
    ProposedPrivilegeHierarchyAnalyzer
  ].each do |parser|
    parser.new(self).analyze
  end
end

- (Object) reports



39
40
41
# File 'lib/declarative_authorization/development_support/analyzer.rb', line 39

def reports
  @reports or raise "No rules analyzed!"
end