Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2217)

Unified Diff: appengine/swarming/handlers_endpoints.py

Issue 2272193004: Add endpoint for permissions (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@migrate-botlist
Patch Set: Consolidate permissions Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/swarming/handlers_endpoints_test.py » ('j') | appengine/swarming/swarming_rpcs.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/handlers_endpoints.py
diff --git a/appengine/swarming/handlers_endpoints.py b/appengine/swarming/handlers_endpoints.py
index 5bc4701537d18e1eebcce2cb1f15c7b6f4e3ea4a..e4573179bf87f60a45f99384ae9cb633c9a45fc9 100644
--- a/appengine/swarming/handlers_endpoints.py
+++ b/appengine/swarming/handlers_endpoints.py
@@ -137,6 +137,22 @@ class SwarmingServerService(remote.Service):
@gae_ts_mon.instrument_endpoint()
@auth.endpoints_method(
+ message_types.VoidMessage, swarming_rpcs.ServerPermissions,
+ http_method='GET')
+ @auth.public
+ def permissions(self, _request):
+ """Returns the caller's permissions."""
+ return swarming_rpcs.ServerPermissions(
M-A Ruel 2016/08/25 19:49:47 Server is kind of odd, it's ClientPermissions ?
kjlubick 2016/08/25 20:21:02 Done.
+ can_delete_bot = acl.is_admin(),
M-A Ruel 2016/08/25 19:49:47 Can we remove the "can_" prefixes? :)
kjlubick 2016/08/25 20:21:02 Done.
+ can_terminate_bot = acl.is_privileged_user(),
+ can_get_configs = acl.is_user(),
+ can_put_configs = acl.is_admin(),
+ can_cancel_task = acl.is_user(),
+ can_get_bootstrap_token = acl.is_bootstrapper(),
+ )
+
+ @gae_ts_mon.instrument_endpoint()
+ @auth.endpoints_method(
VersionRequest, swarming_rpcs.FileContent,
http_method='GET')
@auth.require(acl.is_bot_or_user)
« no previous file with comments | « no previous file | appengine/swarming/handlers_endpoints_test.py » ('j') | appengine/swarming/swarming_rpcs.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698