Merge pull request #2848 from charltonaustin/fix_bug_robot_stuffs

fix(endpoints/api/robot.py): fix misnamed attribute
This commit is contained in:
Charlton Austin 2017-08-01 15:05:43 -04:00 committed by GitHub
commit 0359ac8753
2 changed files with 4 additions and 4 deletions

View file

@ -143,7 +143,7 @@ class UserRobotPermissions(ApiResource):
""" Returns the list of repository permissions for the user's robot. """
parent = get_authenticated_user()
robot = model.get_user_robot(robot_shortname, parent)
permissions = model.list_robot_permissions(robot.username)
permissions = model.list_robot_permissions(robot.name)
return {
'permissions': [permission.to_dict() for permission in permissions]
@ -165,7 +165,7 @@ class OrgRobotPermissions(ApiResource):
permission = AdministerOrganizationPermission(orgname)
if permission.can():
robot = model.get_org_robot(robot_shortname, orgname)
permissions = model.list_robot_permissions(robot.username)
permissions = model.list_robot_permissions(robot.name)
return {
'permissions': [permission.to_dict() for permission in permissions]

View file

@ -29,8 +29,6 @@ class RobotPreOCIModel(RobotInterface):
'teams': [],
'repositories': []
})
robots[robot_name] = RobotWithPermissions(robot_dict['name'], robot_dict['token'], robot_dict['teams'],
robot_dict['repositories'])
robots[robot_name] = Robot(robot_dict['name'], robot_dict['token'])
if include_permissions:
team_name = robot_tuple.get(Team.name)
@ -49,6 +47,8 @@ class RobotPreOCIModel(RobotInterface):
if repository_name is not None:
if repository_name not in robot_dict['repositories']:
robot_dict['repositories'].append(repository_name)
robots[robot_name] = RobotWithPermissions(robot_dict['name'], robot_dict['token'], robot_dict['teams'],
robot_dict['repositories'])
return robots.values()