Scopie
Authorization engine for configuring per user per feature access control. Access is configured via plain text and handled directly via code. Configuration storage is controlled by you, scopie just handles the logic.
- is_allowed(actions: Sequence[str], permissions: Sequence[str], **vars: str) bool
Whether or not the user actions are allowed with the given permissions.
- param actions:
Actions specifies what our user is attemping to do.
- param permissions:
Permissions specifies what our user has access to do.
When using more then one permission, they are treated as a series of OR conditions, and a user will be allowed if they match any of the actions. :returns: If we are allowed to complete the actions. :raises ScopieError: If the actions or permissions are invalid based on scopie requirements
- exception ScopieError(msg: str)
When validating a action or trying to process a action or permission that has an incorrect format we return or throw errors. To keep consistency across languages we define an error format in the specification and include error messages as part of the validation test suite.
Parsing the errors should not be required, this format is aimed at being helpful to log for internal debugging, but are probably not useful for your end users.
In cases where you are taking user input and saving a action, you should use the
validate_actionfunction to check if the provided value is properly formatted. You may also need to do extra processing to make sure the values defined in the action logically make sense in your system as a whole.Reference https://scopie.dev/specification/errors/ for the full list of possible errors.
- scopie.wildcard = '*'
- scopie.super_wildcard = '**'
- scopie.var_prefix = '@'