mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-29 18:40:10 -04:00
remove extrtaneous comments
This commit is contained in:
@@ -177,7 +177,7 @@ class User(JSONModel, UserMixin):
|
||||
# Update the db so the server also knows the user is logged out.
|
||||
self.update(current_session_id=None)
|
||||
logout_user()
|
||||
current_app.logger.info(f"Logged out {self.id}")
|
||||
# current_app.logger.info(f"Logged out {self.id}")
|
||||
|
||||
@property
|
||||
def sms_auth(self):
|
||||
@@ -201,7 +201,7 @@ class User(JSONModel, UserMixin):
|
||||
@property
|
||||
def is_gov_user(self):
|
||||
is_gov = is_gov_user(self.email_address)
|
||||
current_app.logger.info(f"User {self.id} is_gov_user: {is_gov}")
|
||||
# current_app.logger.info(f"User {self.id} is_gov_user: {is_gov}")
|
||||
return is_gov
|
||||
|
||||
@property
|
||||
@@ -210,9 +210,9 @@ class User(JSONModel, UserMixin):
|
||||
|
||||
@property
|
||||
def platform_admin(self):
|
||||
current_app.logger.warn(
|
||||
f"Checking User {self.id} for platform admin: {self._platform_admin}"
|
||||
)
|
||||
# current_app.logger.warning(
|
||||
# f"Checking User {self.id} for platform admin: {self._platform_admin}"
|
||||
# )
|
||||
return self._platform_admin and not session.get(
|
||||
"disable_platform_admin_view", False
|
||||
)
|
||||
@@ -242,26 +242,26 @@ class User(JSONModel, UserMixin):
|
||||
# we shouldn't have any pages that require permissions, but don't specify a service or organization.
|
||||
# use @user_is_platform_admin for platform admin only pages
|
||||
# raise NotImplementedError
|
||||
current_app.logger.warn(f"VIEW ARGS ARE {request.view_args}")
|
||||
# current_app.logger.warning(f"VIEW ARGS ARE {request.view_args}")
|
||||
pass
|
||||
|
||||
log_msg = f"has_permissions user: {self.id} service: {service_id}"
|
||||
# platform admins should be able to do most things (except eg send messages, or create api keys)
|
||||
if self.platform_admin and not restrict_admin_usage:
|
||||
current_app.logger.warn(f"{log_msg} true because user is platform_admin")
|
||||
# current_app.logger.warning(f"{log_msg} true because user is platform_admin")
|
||||
return True
|
||||
|
||||
if org_id:
|
||||
value = self.belongs_to_organization(org_id)
|
||||
current_app.logger.warn(f"{log_msg} org: {org_id} returning {value}")
|
||||
# current_app.logger.warning(f"{log_msg} org: {org_id} returning {value}")
|
||||
return value
|
||||
|
||||
if not permissions and self.belongs_to_service(service_id):
|
||||
current_app.logger.warn(f"{log_msg} True because belongs_to_service")
|
||||
# current_app.logger.warning(f"{log_msg} True because belongs_to_service")
|
||||
return True
|
||||
|
||||
if any(self.permissions_for_service(service_id) & set(permissions)):
|
||||
current_app.logger.warn(f"{log_msg} permissions valid")
|
||||
# current_app.logger.warning(f"{log_msg} permissions valid")
|
||||
return True
|
||||
|
||||
from app.models.service import Service
|
||||
@@ -269,7 +269,7 @@ class User(JSONModel, UserMixin):
|
||||
org_value = allow_org_user and self.belongs_to_organization(
|
||||
Service.from_id(service_id).organization_id
|
||||
)
|
||||
current_app.logger.warn(f"{log_msg} returning {org_value}")
|
||||
# current_app.logger.warning(f"{log_msg} returning {org_value}")
|
||||
return org_value
|
||||
|
||||
def permissions_for_service(self, service_id):
|
||||
@@ -277,10 +277,10 @@ class User(JSONModel, UserMixin):
|
||||
|
||||
def has_permission_for_service(self, service_id, permission):
|
||||
has_permission = permission in self.permissions_for_service(service_id)
|
||||
current_app.logger.warn(
|
||||
f"has_permission_for_service user: {self.id} service: {service_id} "
|
||||
f"permission: {permission} retuning {has_permission}"
|
||||
)
|
||||
# current_app.logger.warning(
|
||||
# f"has_permission_for_service user: {self.id} service: {service_id} "
|
||||
# f"permission: {permission} retuning {has_permission}"
|
||||
# )
|
||||
return has_permission
|
||||
|
||||
def has_template_folder_permission(self, template_folder, service=None):
|
||||
@@ -558,17 +558,17 @@ class InvitedUser(JSONModel):
|
||||
return cls.by_id(invited_user_id) if invited_user_id else None
|
||||
|
||||
def has_permissions(self, *permissions):
|
||||
current_app.logger.warn(
|
||||
f"Checking invited user {self.id} for permissions: {permissions}"
|
||||
)
|
||||
# current_app.logger.warning(
|
||||
# f"Checking invited user {self.id} for permissions: {permissions}"
|
||||
# )
|
||||
if self.status == "cancelled":
|
||||
return False
|
||||
return set(self.permissions) > set(permissions)
|
||||
|
||||
def has_permission_for_service(self, service_id, permission):
|
||||
current_app.logger.warn(
|
||||
f"Checking invited user {self.id} for permission: {permission} on service {service_id}"
|
||||
)
|
||||
# current_app.logger.warn(
|
||||
# f"Checking invited user {self.id} for permission: {permission} on service {service_id}"
|
||||
# )
|
||||
if self.status == "cancelled":
|
||||
return False
|
||||
return self.service == service_id and permission in self.permissions
|
||||
|
||||
Reference in New Issue
Block a user