Commit 325ddbe1 authored by Muhamed Parić's avatar Muhamed Parić Committed by Commit Bot

Fixed changes to timezones in managed guest sessions not taking effect

Timezone changes in managed guest sessions used to not take effect even
when the policy was set to allow for them. Now a policy check is done
instead. These changes will still not persist through logging out/rebooting,
as these are temporary sessions.

Bug: 907667
Change-Id: Ib4f92f46b9bc9119afd44eb067f9cba2acf2d1f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869656Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Muhamed Parić <muhamedp@google.com>
Cr-Commit-Position: refs/heads/master@{#714191}
parent c5b6b568
...@@ -151,6 +151,17 @@ base::string16 GetTimezoneName(const icu::TimeZone& timezone) { ...@@ -151,6 +151,17 @@ base::string16 GetTimezoneName(const icu::TimeZone& timezone) {
return result; return result;
} }
bool CanSetSystemTimezoneFromManagedGuestSession() {
const int automatic_detection_policy =
g_browser_process->local_state()->GetInteger(
prefs::kSystemTimezoneAutomaticDetectionPolicy);
return (automatic_detection_policy ==
enterprise_management::SystemTimezoneProto::DISABLED) ||
(automatic_detection_policy ==
enterprise_management::SystemTimezoneProto::USERS_DECIDE);
}
// Returns true if the given user is allowed to set the system timezone - that // Returns true if the given user is allowed to set the system timezone - that
// is, the single timezone at TimezoneSettings::GetInstance()->GetTimezone(), // is, the single timezone at TimezoneSettings::GetInstance()->GetTimezone(),
// which is also stored in a file at /var/lib/timezone/localtime. // which is also stored in a file at /var/lib/timezone/localtime.
...@@ -168,13 +179,15 @@ bool CanSetSystemTimezone(const user_manager::User* user) { ...@@ -168,13 +179,15 @@ bool CanSetSystemTimezone(const user_manager::User* user) {
return true; return true;
case user_manager::USER_TYPE_GUEST: case user_manager::USER_TYPE_GUEST:
case user_manager::USER_TYPE_PUBLIC_ACCOUNT:
return false; return false;
case user_manager::USER_TYPE_CHILD: case user_manager::USER_TYPE_CHILD:
return base::FeatureList::IsEnabled( return base::FeatureList::IsEnabled(
features::kParentAccessCodeForTimeChange); features::kParentAccessCodeForTimeChange);
case user_manager::USER_TYPE_PUBLIC_ACCOUNT:
return CanSetSystemTimezoneFromManagedGuestSession();
case user_manager::NUM_USER_TYPES: case user_manager::NUM_USER_TYPES:
NOTREACHED(); NOTREACHED();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment