Commit 0ee0f645 authored by mtomasz@chromium.org's avatar mtomasz@chromium.org

Respect disabling removable devices policy for enterprise users.

After recent refactoring, the volume manager is created for every profile, and listens to cros disks events on each of them. As a result, if a USB is inserted, then it is handled by all of the available profiles. If one of them has the policy disabling removable devices set to false, then all profiles (including those having the policy set to true) will get the device mounted.

To fix this, this CL prevents this situation, by not adding the VolumeInfo and not emiting an event, if the device is not permitted (but got mounted by another profile).

TEST=Tested manually on a enterprise enrolled device.
BUG=349298

Review URL: https://codereview.chromium.org/190153003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255610 0039d316-1c4b-4281-b951-d872f2087c98
parent ccb73722
...@@ -632,6 +632,12 @@ void VolumeManager::DoMountEvent(chromeos::MountError error_code, ...@@ -632,6 +632,12 @@ void VolumeManager::DoMountEvent(chromeos::MountError error_code,
return; return;
} }
// Filter out removable disks if forbidden by policy for this profile.
if (volume_info.type == VOLUME_TYPE_REMOVABLE_DISK_PARTITION &&
profile_->GetPrefs()->GetBoolean(prefs::kExternalStorageDisabled)) {
return;
}
if (error_code == chromeos::MOUNT_ERROR_NONE || volume_info.mount_condition) if (error_code == chromeos::MOUNT_ERROR_NONE || volume_info.mount_condition)
mounted_volumes_[volume_info.volume_id] = volume_info; mounted_volumes_[volume_info.volume_id] = volume_info;
......
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