Filter out deleted users and organizations from the superuser list
Superusers were getting confused because the users/orgs were being disabled and renamed, but still appeared in the list until they were GCed by the background worker. Now we just hide them. Fixes https://jira.coreos.com/browse/QUAY-936
This commit is contained in:
parent
7878435805
commit
b98c65b3a3
4 changed files with 55 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
|||
|
||||
from data.database import (User, FederatedLogin, TeamMember, Team, TeamRole, RepositoryPermission,
|
||||
Repository, Namespace)
|
||||
Repository, Namespace, DeletedNamespace)
|
||||
from data.model import (user, team, DataModelException, InvalidOrganizationException,
|
||||
InvalidUsernameException, db_transaction, _basequery)
|
||||
|
||||
|
@ -145,8 +145,13 @@ def get_all_repo_users_transitive_via_teams(namespace_name, repository_name):
|
|||
.where(Namespace.username == namespace_name, Repository.name == repository_name))
|
||||
|
||||
|
||||
def get_organizations():
|
||||
return User.select().where(User.organization == True, User.robot == False)
|
||||
def get_organizations(deleted=False):
|
||||
query = User.select().where(User.organization == True, User.robot == False)
|
||||
|
||||
if not deleted:
|
||||
query = query.where(User.id.not_in(DeletedNamespace.select(DeletedNamespace.namespace)))
|
||||
|
||||
return query
|
||||
|
||||
|
||||
def get_active_org_count():
|
||||
|
|
Reference in a new issue