mirror of
https://github.com/quay/quay.git
synced 2025-07-30 07:43:13 +03:00
api: adding token to global readonly user list robots (PROJQUAY-7177) (#3073)
Adding robot token to response for global readonly superuser.
This commit is contained in:
@ -188,9 +188,10 @@ class OrgRobotList(ApiResource):
|
||||
"""
|
||||
permission = OrganizationMemberPermission(orgname)
|
||||
if permission.can() or allow_if_superuser() or allow_if_global_readonly_superuser():
|
||||
include_token = AdministerOrganizationPermission(orgname).can() and parsed_args.get(
|
||||
"token", True
|
||||
)
|
||||
include_token = (
|
||||
AdministerOrganizationPermission(orgname).can()
|
||||
or allow_if_global_readonly_superuser()
|
||||
) and parsed_args.get("token", True)
|
||||
include_permissions = AdministerOrganizationPermission(
|
||||
orgname
|
||||
).can() and parsed_args.get("permissions", False)
|
||||
|
@ -3919,6 +3919,12 @@ class TestOrgRobots(ApiTestCase):
|
||||
|
||||
self.assertEqual(json["token"], json2["token"])
|
||||
|
||||
def test_get_robots_as_globalreadonlysuperuser(self):
|
||||
self.login("globalreadonlysuperuser")
|
||||
params = dict(orgname=ORGANIZATION)
|
||||
for r in self.getJsonResponse(OrgRobotList, params=params)["robots"]:
|
||||
assert "token" in r
|
||||
|
||||
|
||||
class TestLogs(ApiTestCase):
|
||||
def test_repo_logs(self):
|
||||
|
Reference in New Issue
Block a user