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

Unified Diff: device_policy.h

Issue 6815021: [login_manager] Code to add the owner to the whitelist in a device policy (Closed) Base URL: http://git.chromium.org/git/login_manager.git@master
Patch Set: address gauravsh comments Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Makefile ('k') | device_policy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device_policy.h
diff --git a/device_policy.h b/device_policy.h
index 9d1c705ccad196639e8bd8f4f83fc3f17dcca030..c58760f93dc7167a07daeac77c56d23365f594c4 100644
--- a/device_policy.h
+++ b/device_policy.h
@@ -5,6 +5,7 @@
#ifndef LOGIN_MANAGER_DEVICE_POLICY_H_
#define LOGIN_MANAGER_DEVICE_POLICY_H_
+#include <glib.h>
#include <string>
#include <base/basictypes.h>
@@ -13,6 +14,7 @@
#include "login_manager/bindings/device_management_backend.pb.h"
namespace login_manager {
+class OwnerKey;
// This class holds device settings that are to be enforced across all users.
//
@@ -30,16 +32,30 @@ class DevicePolicy {
// Returns true unless there is a policy on disk and loading it fails.
virtual bool LoadOrCreate();
- virtual bool Get(std::string* output) const;
+ virtual const enterprise_management::PolicyFetchResponse& Get() const;
// Persist |policy_| to disk at |policy_file_|
// Returns false if there's an error while writing data.
virtual bool Persist();
+ virtual bool SerializeToString(std::string* output) const;
+
// Clobber the stored policy with new data.
virtual void Set(const enterprise_management::PolicyFetchResponse& policy);
+ // Assuming the current user has access to the owner private key
+ // (read: is the owner), this call whitelists |current_user_| and sets a
+ // property indicating |current_user_| is the owner in the current policy
+ // and schedules a PersistPolicy().
+ // Returns false on failure, with |error| set appropriately.
+ // |error| can be NULL, should you wish to ignore the particulars.
+ bool StoreOwnerProperties(OwnerKey* key,
+ const std::string& current_user,
+ GError** error);
+
static const char kDefaultPath[];
+ // Format of this string is documented in device_management_backend.proto.
+ static const char kDevicePolicyType[];
private:
enterprise_management::PolicyFetchResponse policy_;
« no previous file with comments | « Makefile ('k') | device_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698