mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-05-19 10:40:15 +00:00
tests: add tests for access control service and policy engine
This commit is contained in:
@@ -61,6 +61,7 @@ func NewPolicyEngine(config model.Config, log *logger.Logger) (*PolicyEngine, er
|
||||
}
|
||||
|
||||
func (engine *PolicyEngine) RegisterRule(name RuleName, rule Rule) {
|
||||
engine.log.App.Debug().Str("rule", string(name)).Msg("Registering ACL rule in policy engine")
|
||||
engine.rules[name] = rule
|
||||
}
|
||||
|
||||
@@ -99,3 +100,11 @@ func (engine *PolicyEngine) Evaluate(name RuleName, ctx *ACLContext) bool {
|
||||
|
||||
return access
|
||||
}
|
||||
|
||||
func (engine *PolicyEngine) Policy() Policy {
|
||||
return engine.policy
|
||||
}
|
||||
|
||||
func (engine *PolicyEngine) Rules() map[RuleName]Rule {
|
||||
return engine.rules
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user