backend.utils.check_permissions

Permission check helpers.

Provides simple role-based access control functions used by API route handlers to guard admin- and editor-only endpoints.

backend.utils.check_permissions.check_admin(current)[Quellcode]

Return True if the current user has the admin role.

Parameter:

current (dict) – Token payload dict with at least a user_group key (as returned by auth.get_current_user()).

Rückgabe:

True for admins, False for all other roles.

Rückgabetyp:

bool

backend.utils.check_permissions.check_editor(current)[Quellcode]

Return True if the current user has the admin or editor role.

Parameter:

current (dict) – Token payload dict with at least a user_group key.

Rückgabe:

True for admins and editors, False otherwise.

Rückgabetyp:

bool