cmsmanage/doorcontrol/dashboard.py
Adam Goldsmith 638db1c0b7
All checks were successful
Ruff / ruff (push) Successful in 1m2s
Test / test (push) Successful in 6m25s
doorcontrol: Add interface for adding/assigning UniFi Access NFC Cards
2024-12-11 13:03:37 -05:00

30 lines
788 B
Python

from django.urls import reverse
import dashboard
from dashboard import Link
from .views import REPORTS
@dashboard.register
class DoorControlDashboardFragment(dashboard.LinksCardDashboardFragment):
name = "Door Controls"
@property
def links(self) -> list[Link]:
return [
Link(name, link, permission="doorcontrol.view_hidevent")
for report in REPORTS
for name, link in report._report_types()
] + [
Link(
"Assign NFC Card ",
reverse("doorcontrol:assign-nfc-card-user-selector"),
permission="doorcontrol.assign_nfc_card",
)
]
@property
def visible(self) -> bool:
return self.request.user.has_perm("doorcontrol.view_hidevent")