Files
MrBlake f36d6be511
CI / php-store (push) Waiting to run
CI / python-components (push) Waiting to run
feat: add NetBox plugin store
2026-08-24 20:51:25 +02:00

19 lines
486 B
Python

from __future__ import annotations
from typing import Protocol
class PermissionUser(Protocol):
is_authenticated: bool
is_superuser: bool
def has_perm(self, permission_name: str) -> bool: ...
def has_store_access(user: PermissionUser, permission_name: str) -> bool:
"""Authorize NetBox users without relying on the removed ``is_staff`` field."""
return bool(
user.is_authenticated
and (user.is_superuser or user.has_perm(permission_name))
)