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

Side by Side Diff: chrome/browser/chromeos/login/users/affiliation.cc

Issue 2378043002: Remove IsUserAffiliated()'s obsolete dependency on enrollment domain. (Closed)
Patch Set: Created 4 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "chrome/browser/chromeos/login/users/affiliation.h" 5 #include "chrome/browser/chromeos/login/users/affiliation.h"
6 6
7 #include "chrome/browser/chromeos/policy/device_local_account.h" 7 #include "chrome/browser/chromeos/policy/device_local_account.h"
8 #include "google_apis/gaia/gaia_auth_util.h" 8 #include "google_apis/gaia/gaia_auth_util.h"
9 9
10 namespace chromeos { 10 namespace chromeos {
(...skipping 10 matching lines...) Expand all
21 ++it1; 21 ++it1;
22 } else { 22 } else {
23 ++it2; 23 ++it2;
24 } 24 }
25 } 25 }
26 return false; 26 return false;
27 } 27 }
28 28
29 bool IsUserAffiliated(const AffiliationIDSet& user_affiliation_ids, 29 bool IsUserAffiliated(const AffiliationIDSet& user_affiliation_ids,
30 const AffiliationIDSet& device_affiliation_ids, 30 const AffiliationIDSet& device_affiliation_ids,
31 const std::string& email, 31 const std::string& email) {
32 const std::string& enterprise_domain) { 32 // An empty username means incognito user in case of Chrome OS and no
33 // An empty username means incognito user in case of ChromiumOS and 33 // logged-in user in case of Chrome (SigninService). Many tests use nonsense
34 // no logged-in user in case of Chromium (SigninService). Many tests use 34 // email addresses (e.g. 'test') so treat those as non-enterprise users.
35 // nonsense email addresses (e.g. 'test') so treat those as non-enterprise
36 // users.
37 if (email.empty() || email.find('@') == std::string::npos) { 35 if (email.empty() || email.find('@') == std::string::npos) {
38 return false; 36 return false;
39 } 37 }
40 38
41 if (policy::IsDeviceLocalAccountUser(email, NULL)) { 39 if (policy::IsDeviceLocalAccountUser(email, NULL)) {
42 return true; 40 return true;
43 } 41 }
44 42
45 if (!device_affiliation_ids.empty() && !user_affiliation_ids.empty()) { 43 if (!device_affiliation_ids.empty() && !user_affiliation_ids.empty()) {
46 return HaveCommonElement(user_affiliation_ids, device_affiliation_ids); 44 return HaveCommonElement(user_affiliation_ids, device_affiliation_ids);
47 } 45 }
48 46
49 // TODO(peletskyi): Remove the following backwards compatibility part.
50 if (gaia::ExtractDomainName(gaia::CanonicalizeEmail(email)) ==
51 enterprise_domain) {
52 return true;
53 }
54
55 return false; 47 return false;
56 } 48 }
57 49
58 } // namespace chromeos 50 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698