Utils

class keg_auth.model.utils.AllCondition(*conditions)

Condition requiring all contained permissions/conditions to be satisfied.

Rules governing the contained permission/conditions: - Not all conditions are guaranteed to be checked. Checking will exit on the first failure. - Callable conditions are expected to take a user argument. - Permission token conditions are run if the user has a has_all_permissions method (default case).

class keg_auth.model.utils.AnyCondition(*conditions)

Condition requiring only one of the contained permissions/conditions to be satisfied.

Rules governing the contained permission/conditions: - Not all conditions are guaranteed to be checked. Checking will exit on the first success. - Callable conditions are expected to take a user argument. - Permission token conditions are run if the user has a has_all_permissions method (default case).

class keg_auth.model.utils.PermissionCondition(*conditions)

Basic permission condition that will return True/False upon user access check.

One or more permissions or conditions must be provided to the constructor.

keg_auth.model.utils.has_all

alias of keg_auth.model.utils.AllCondition

keg_auth.model.utils.has_any

alias of keg_auth.model.utils.AnyCondition

keg_auth.model.utils.has_permissions(condition, user)

Check a user against a single condition/permission.