
permission_utils.py
About this file
This file contains util functions pertaining to validating permissions. The functions in this file check for user authentication, super user status, and allowed permissions. The last function 'get_permission(permission_type: str, response_type: Responses)' returns a dictionary of associated permissions for files, notes, instructions, and links.
Code Check Report
No problems to report
Documentation drawn from source code
has_permission(permission: int):
Checks to see if the current_user has the appropriate permission for this endpoint.:param f: View function that is being wrapped.:param permissions: List of permission values.:return:
decorator(f):
decorated_function(request_id, *args, **kwargs):
has_super():
Checks to see if the current_user is a super user.:param f: Function that is being wrapped.:return:
decorator(f):
decorated_function(*args, **kwargs):
is_allowed(user: Users, request_id: str, permission: int):
:param user::param request_id::param permissions::return:
get_permission(permission_type: str, response_type: Responses):
:param permission_type::param response_type::return: