Maslosoft Framework Logo Maslosoft Framework Documentation
Flexible Application Foundation


Create Custom Access Control Rule

To create Access Control Rule, the most basic one, implement interface AclRuleInterface which is pretty simple, as it contains only one method: getLevel().

Should return access level, one of:

  • Access::Allow
  • Access::NoAccess
  • Access::Deny

Parametrized access rule

More options are possible with parametrized rule, which could be created by implementing ParamsAwareInteface (default implementation is available: ParamsAwareTrait). Requires two methods:

  • getParams() - Get params set by annotations, these are previously set by setParams.

  • setParams() - Set rule params. These params are taken from annotation, and internally passed to ACL rule by passing them into this method.

Reading model values

Access Rule can also interact with checked model, to benefit from this, implement ModelAwareInterface