mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-03 21:21:14 -04:00
Let users with empty permissions see certain pages
We’re going to make it possible for some users to be members of a service, but not have any permissions (not even `view_activity`). There are some pages that these users should still be able to see These are the pages that a user with ‘basic view’ would have been able to see, excluding those that let them send messages.
This commit is contained in:
@@ -124,7 +124,10 @@ class User(UserMixin):
|
||||
org_id = _get_org_id_from_view_args()
|
||||
|
||||
if self.previewing_basic_view:
|
||||
return self._permissions.get(service_id) and 'send_messages' in permissions
|
||||
return self._permissions.get(service_id) and (
|
||||
'send_messages' in permissions or
|
||||
permissions == ()
|
||||
)
|
||||
|
||||
if not service_id and not org_id:
|
||||
# we shouldn't have any pages that require permissions, but don't specify a service or organisation.
|
||||
@@ -137,7 +140,9 @@ class User(UserMixin):
|
||||
|
||||
if org_id:
|
||||
return org_id in self.organisations
|
||||
elif service_id:
|
||||
if not permissions:
|
||||
return service_id in self._permissions
|
||||
if service_id:
|
||||
return any(x in self._permissions.get(service_id, []) for x in permissions)
|
||||
|
||||
def has_permission_for_service(self, service_id, permission):
|
||||
|
||||
Reference in New Issue
Block a user