mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Hide ‘back to …’ link if it’s not your service
This can happen if you click a link for a service you don’t have access to. We shouldn’t show the back to service link in this case because: - you shouldn’t be able to find out the service’s name from just knowing the link - if you click the link you only get a `403` anyway
This commit is contained in:
@@ -151,8 +151,11 @@ class User(UserMixin):
|
||||
def has_permission_for_service(self, service_id, permission):
|
||||
return permission in self._permissions.get(service_id, [])
|
||||
|
||||
def belongs_to_service(self, service_id):
|
||||
return str(service_id) in self.services
|
||||
|
||||
def belongs_to_service_or_403(self, service_id):
|
||||
if str(service_id) not in self.services:
|
||||
if not self.belongs_to_service(service_id):
|
||||
abort(403)
|
||||
|
||||
def is_locked(self):
|
||||
|
||||
Reference in New Issue
Block a user