mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Refactor logic out of Jinja before making more complicated
To keep the conditionals in the Jinja template more readable, this commit moves the logic into a method on the model, where it can be split over multiple statements and lines.
This commit is contained in:
@@ -440,6 +440,13 @@ class User(JSONModel, UserMixin):
|
||||
def complete_webauthn_login_attempt(self, is_successful=True):
|
||||
return user_api_client.complete_webauthn_login_attempt(self.id, is_successful)
|
||||
|
||||
def is_editable_by(self, other_user):
|
||||
if other_user == self:
|
||||
return False
|
||||
if self.state == 'active':
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class InvitedUser(JSONModel):
|
||||
|
||||
@@ -575,6 +582,9 @@ class InvitedUser(JSONModel):
|
||||
# only used on the manage users page to display the count, so okay to not be fully fledged for now
|
||||
return [{'id': x} for x in self.folder_permissions]
|
||||
|
||||
def is_editable_by(self, other):
|
||||
return False
|
||||
|
||||
|
||||
class InvitedOrgUser(JSONModel):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user