James Gardner: Home > Work > Code > PermissionKit > 0.5.0 > API Documentation

PermissionKit v0.5.0 documentation

API Documentation

Functions to facilitate checking permissions

permissionkit.check.check(state, permission, on_pass, on_not_authenticated, on_not_authorized)
Check a permission and automatically handle the result
permissionkit.check.prepare_check(on_pass, on_not_authenticated, on_not_authorized)
permissionkit.check.prepare_proceed_if(on_fail=None, on_not_authenticated=None, on_not_authorized=None)
permissionkit.check.proceed_if(permission, on_fail=None, on_not_authenticated=None, on_not_authorized=None)

Used like this:

@proceed_if(is_valid_user, on_fail=return_401_response)
@proceed_if(
    is_valid_user, 
    on_not_authenticated=redirect_to_signin,  
    on_not_authorized=return_403_response,
)

Permissions related to a user’s username

permissionkit.user.is_valid_user(flow)
James Gardner: Home > Work > Code > PermissionKit > 0.5.0 > API Documentation