Add permissions-based visible
method to LinksCardDashboardFragment
This commit is contained in:
parent
aef53b1828
commit
bc52dd3369
@ -38,3 +38,10 @@ class LinksCardDashboardFragment(DashboardFragment):
|
|||||||
@property
|
@property
|
||||||
def context(self):
|
def context(self):
|
||||||
return {"links": self.links}
|
return {"links": self.links}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def visible(self) -> bool:
|
||||||
|
return any(
|
||||||
|
link.permission is None or self.request.user.has_perm(link.permission)
|
||||||
|
for link in self.links
|
||||||
|
)
|
||||||
|
@ -31,7 +31,3 @@ class MembershipworksDashboardFragment(dashboard.LinksCardDashboardFragment):
|
|||||||
permission="membershipworks.view_member",
|
permission="membershipworks.view_member",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
|
||||||
def visible(self) -> bool:
|
|
||||||
return self.request.user.has_perm("doorcontrol.view_hidevent")
|
|
||||||
|
Loading…
Reference in New Issue
Block a user