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

Side by Side Diff: appengine/auth_service/handlers_frontend.py

Issue 1148073005: Use luci-config for infrequently changing settings, part 2. (Closed) Base URL: git@github.com:luci/luci-py@master
Patch Set: fix pylint (??!) Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « appengine/auth_service/config.py ('k') | appengine/auth_service/handlers_frontend_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Swarming Authors. All rights reserved. 1 # Copyright 2014 The Swarming Authors. All rights reserved.
2 # Use of this source code is governed by the Apache v2.0 license that can be 2 # Use of this source code is governed by the Apache v2.0 license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """This module defines Auth Server frontend url handlers.""" 5 """This module defines Auth Server frontend url handlers."""
6 6
7 import os 7 import os
8 8
9 import webapp2 9 import webapp2
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 expiration_sec = 24 * 3600 87 expiration_sec = 24 * 3600
88 secret_key = auth.SecretKey('link_ticket_token', scope='local') 88 secret_key = auth.SecretKey('link_ticket_token', scope='local')
89 version = 1 89 version = 1
90 90
91 91
92 class ImporterConfigHandler(auth.ApiHandler): 92 class ImporterConfigHandler(auth.ApiHandler):
93 """Reads and sets configuration of the group importer.""" 93 """Reads and sets configuration of the group importer."""
94 94
95 @auth.require(auth.is_admin) 95 @auth.require(auth.is_admin)
96 def get(self): 96 def get(self):
97 self.send_response({'config': importer.read_config()}) 97 self.send_response({'config': importer.read_config_text()})
98 98
99 @auth.require(auth.is_admin) 99 @auth.require(auth.is_admin)
100 def post(self): 100 def post(self):
101 if config.is_remote_configured(): 101 if config.is_remote_configured():
102 self.abort_with_error(409, text='The configuration is managed elsewhere') 102 self.abort_with_error(409, text='The configuration is managed elsewhere')
103 conf = self.parse_body().get('config') 103 try:
104 if not importer.is_valid_config(conf): 104 importer.write_config_text(self.parse_body().get('config'))
105 self.abort_with_error(400, text='Invalid config format.') 105 except ValueError as ex:
106 importer.write_config(conf) 106 self.abort_with_error(400, text=str(ex))
107 self.send_response({'ok': True}) 107 self.send_response({'ok': True})
108 108
109 109
110 class ServiceListingHandler(auth.ApiHandler): 110 class ServiceListingHandler(auth.ApiHandler):
111 """Lists registered replicas with their state.""" 111 """Lists registered replicas with their state."""
112 112
113 @auth.require(auth.is_admin) 113 @auth.require(auth.is_admin)
114 def get(self): 114 def get(self):
115 services = sorted( 115 services = sorted(
116 replication.AuthReplicaState.query( 116 replication.AuthReplicaState.query(
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 env_callback=get_additional_ui_environment) 275 env_callback=get_additional_ui_environment)
276 template.bootstrap({'auth_service': TEMPLATES_DIR}) 276 template.bootstrap({'auth_service': TEMPLATES_DIR})
277 277
278 # Add a fake admin for local dev server. 278 # Add a fake admin for local dev server.
279 if utils.is_local_dev_server(): 279 if utils.is_local_dev_server():
280 auth.bootstrap_group( 280 auth.bootstrap_group(
281 auth.ADMIN_GROUP, 281 auth.ADMIN_GROUP,
282 [auth.Identity(auth.IDENTITY_USER, 'test@example.com')], 282 [auth.Identity(auth.IDENTITY_USER, 'test@example.com')],
283 'Users that can manage groups') 283 'Users that can manage groups')
284 return webapp2.WSGIApplication(get_routes(), debug=debug) 284 return webapp2.WSGIApplication(get_routes(), debug=debug)
OLDNEW
« no previous file with comments | « appengine/auth_service/config.py ('k') | appengine/auth_service/handlers_frontend_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698