feat: add NetBox plugin store
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
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))
|
||||
)
|
||||
Reference in New Issue
Block a user