db: prevent empty IN queries that generally are performance problem, and triggers sql warnings.

This commit is contained in:
Marcin Kuzminski 2017-10-17 20:32:23 +02:00
parent 69a865a7a3
commit e6fa851ff8
2 changed files with 2 additions and 2 deletions

View file

@ -100,7 +100,7 @@ class AdminUserGroupsView(BaseAppView, DataGridAppView):
auth_user_group_list = UserGroupList(
UserGroup.query().all(), perm_set=['usergroup.admin'])
allowed_ids = []
allowed_ids = [-1]
for user_group in auth_user_group_list:
allowed_ids.append(user_group.users_group_id)

View file

@ -90,7 +90,7 @@ class RepoForksView(RepoAppView, DataGridAppView):
acl_check = HasRepoPermissionAny(
'repository.read', 'repository.write', 'repository.admin')
repo_id = self.db_repo.repo_id
allowed_ids = []
allowed_ids = [-1]
for f in Repository.query().filter(Repository.fork_id == repo_id):
if acl_check(f.repo_name, 'get forks check'):
allowed_ids.append(f.repo_id)