cmsmanage/doorcontrol/dashboard.py
2024-02-06 00:42:14 -05:00

22 lines
545 B
Python

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()
]
@property
def visible(self) -> bool:
return self.request.user.has_perm("doorcontrol.view_hidevent")