From 622cb351b73a64b814c4dd952af7656d7fc9ff93 Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Thu, 2 Jan 2025 23:02:38 +0100 Subject: [PATCH] Add api admin check --- archivist/apps/api/permissions.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 archivist/apps/api/permissions.py diff --git a/archivist/apps/api/permissions.py b/archivist/apps/api/permissions.py new file mode 100644 index 0000000..bc52a72 --- /dev/null +++ b/archivist/apps/api/permissions.py @@ -0,0 +1,6 @@ +# permissions.py + +def check_admin(user): + """check for admin permission for restricted views""" + return user.is_staff or user.groups.filter(name="admin").exists() +