fix org invites

This commit is contained in:
Kenneth Kehl
2025-09-08 11:57:43 -07:00
parent 31e72ea24b
commit de16e760ea
3 changed files with 89 additions and 22 deletions

View File

@@ -255,9 +255,15 @@ class User(JSONModel, UserMixin):
if org_id:
value = self.belongs_to_organization(org_id)
current_app.logger.debug(
f"has_permissions returns org: {org_id} returning {value}"
)
if not value:
# TODO this is sketch! Fix this!
# This is temporary to restore org invite functionality only
self.add_to_organization(org_id)
value = self.belongs_to_organization(org_id)
current_app.logger.debug(
f"has_permissions returns org: {org_id} returning {value}"
)
return value
if not permissions and self.belongs_to_service(service_id):
@@ -317,6 +323,11 @@ class User(JSONModel, UserMixin):
abort(403)
def belongs_to_organization(self, organization_id):
# TODO this is sketch! Fix this!
# This is temporary to restore org invite functionality only
if str(organization_id) not in self.organization_ids:
self.add_to_organization(organization_id)
return str(organization_id) in self.organization_ids
@property