- Fix tests

- Add new endpoints for retrieving the repo permissions for a robot account
- Have the robots list return the number of repositories for which there are permissions
- Other UI fixes
This commit is contained in:
Joseph Schorr 2015-03-31 18:50:43 -04:00
parent bb81c05c03
commit 1f5e6df678
16 changed files with 356 additions and 60 deletions

View file

@ -312,9 +312,23 @@ def _list_entity_robots(entity_name):
def list_entity_robot_tuples(entity_name):
return (_list_entity_robots(entity_name)
.select(User.username, FederatedLogin.service_ident)
.join(RepositoryPermission, JOIN_LEFT_OUTER,
on=(RepositoryPermission.user == FederatedLogin.user))
.join(Repository, JOIN_LEFT_OUTER)
.switch(User)
.group_by(User, FederatedLogin)
.select(User.username, FederatedLogin.service_ident, fn.Count(Repository.id))
.tuples())
def list_robot_permissions(robot_name):
return (RepositoryPermission.select(RepositoryPermission, User, Repository)
.join(Repository)
.join(Visibility)
.switch(RepositoryPermission)
.join(Role)
.switch(RepositoryPermission)
.join(User)
.where(User.username == robot_name, User.robot == True))
def convert_user_to_organization(user, admin_user):
# Change the user to an organization.