mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Refactor government user check onto model
This commit is contained in:
@@ -3,6 +3,9 @@ from itertools import chain
|
||||
from flask import request, session
|
||||
from flask_login import AnonymousUserMixin, UserMixin
|
||||
|
||||
from app.utils import is_gov_user
|
||||
|
||||
|
||||
roles = {
|
||||
'send_messages': ['send_texts', 'send_emails', 'send_letters'],
|
||||
'manage_templates': ['manage_templates'],
|
||||
@@ -102,6 +105,10 @@ class User(UserMixin):
|
||||
def is_active(self):
|
||||
return self.state == 'active'
|
||||
|
||||
@property
|
||||
def is_gov_user(self):
|
||||
return is_gov_user(self.email_address)
|
||||
|
||||
@property
|
||||
def is_authenticated(self):
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user