Class: Authorization::DevelopmentSupport::Analyzer::RoleExplosionAnalyzer

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

Constant Summary collapse

SMALL_ROLE_RULES_COUNT =
3
SMALL_ROLES_RATIO =
0.2

Instance Method Summary collapse

Methods inherited from GeneralRulesAnalyzer

#analyze, #initialize

Constructor Details

This class inherits a constructor from Authorization::DevelopmentSupport::Analyzer::GeneralRulesAnalyzer

Instance Method Details

#analyze_policyObject



102
103
104
# File 'lib/declarative_authorization/development_support/analyzer.rb', line 102

def analyze_policy
  small_roles.length > 1 and small_roles.length.to_f / roles.length.to_f > SMALL_ROLES_RATIO
end

#message(object) ⇒ Object



106
107
108
# File 'lib/declarative_authorization/development_support/analyzer.rb', line 106

def message (object)
  "The ratio of small roles is quite high (> %.0f%%).  Consider refactoring." % (SMALL_ROLES_RATIO * 100)
end