mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Refactor to use .belongs_to methods
The view code shouldn’t need to know the internals of a service’s data structure; the idea of having a service model is to abstract this kind of thing.
This commit is contained in:
@@ -228,6 +228,9 @@ class User(JSONModel, UserMixin):
|
||||
if not self.belongs_to_service(service_id):
|
||||
abort(403)
|
||||
|
||||
def belongs_to_organisation(self, organisation_id):
|
||||
return str(organisation_id) in self.organisation_ids
|
||||
|
||||
@property
|
||||
def locked(self):
|
||||
return self.failed_login_count >= self.max_failed_login_count
|
||||
|
||||
Reference in New Issue
Block a user