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

Side by Side Diff: chrome/browser/policy/test/policy_testserver.py

Issue 1262883003: Revert of Added affiliation IDs for the new affiliation determination. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """A bare-bones test server for testing cloud policy support. 5 """A bare-bones test server for testing cloud policy support.
6 6
7 This implements a simple cloud policy test server that can be used to test 7 This implements a simple cloud policy test server that can be used to test
8 chrome's device management service client. The policy information is read from 8 chrome's device management service client. The policy information is read from
9 the file named device_management in the server's data directory. It contains 9 the file named device_management in the server's data directory. It contains
10 enforced and recommended policies for the device and user scope, and a list 10 enforced and recommended policies for the device and user scope, and a list
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 if signing_key: 805 if signing_key:
806 policy_data.public_key_version = current_key_index + 1 806 policy_data.public_key_version = current_key_index + 1
807 807
808 if username: 808 if username:
809 policy_data.username = username 809 policy_data.username = username
810 else: 810 else:
811 # If the correct |username| is unknown, rely on a manually-configured 811 # If the correct |username| is unknown, rely on a manually-configured
812 # username from the configuration file or use a default. 812 # username from the configuration file or use a default.
813 policy_data.username = policy.get('policy_user', 'user@example.com') 813 policy_data.username = policy.get('policy_user', 'user@example.com')
814 policy_data.device_id = token_info['device_id'] 814 policy_data.device_id = token_info['device_id']
815
816 # Set affiliation IDs so that user was managed on the device.
817 device_affiliation_ids = policy.get('device_affiliation_ids')
818 if device_affiliation_ids:
819 policy_data.device_affiliation_ids.extend(device_affiliation_ids)
820
821 user_affiliation_ids = policy.get('user_affiliation_ids')
822 if user_affiliation_ids:
823 policy_data.user_affiliation_ids.extend(user_affiliation_ids)
824
825 signed_data = policy_data.SerializeToString() 815 signed_data = policy_data.SerializeToString()
826 816
827 response.policy_data = signed_data 817 response.policy_data = signed_data
828 if signing_key: 818 if signing_key:
829 response.policy_data_signature = ( 819 response.policy_data_signature = (
830 bytes(signing_key['private_key'].hashAndSign(signed_data))) 820 bytes(signing_key['private_key'].hashAndSign(signed_data)))
831 if msg.public_key_version != current_key_index + 1: 821 if msg.public_key_version != current_key_index + 1:
832 response.new_public_key = signing_key['public_key'] 822 response.new_public_key = signing_key['public_key']
833 823
834 # Set the verification signature appropriate for the policy domain. 824 # Set the verification signature appropriate for the policy domain.
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 if (self.options.log_to_console): 1303 if (self.options.log_to_console):
1314 logger.addHandler(logging.StreamHandler()) 1304 logger.addHandler(logging.StreamHandler())
1315 if (self.options.log_file): 1305 if (self.options.log_file):
1316 logger.addHandler(logging.FileHandler(self.options.log_file)) 1306 logger.addHandler(logging.FileHandler(self.options.log_file))
1317 1307
1318 testserver_base.TestServerRunner.run_server(self) 1308 testserver_base.TestServerRunner.run_server(self)
1319 1309
1320 1310
1321 if __name__ == '__main__': 1311 if __name__ == '__main__':
1322 sys.exit(PolicyServerRunner().main()) 1312 sys.exit(PolicyServerRunner().main())
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698