summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang zhengguang <zhengguang.zhang@intel.com>2014-10-17 03:21:37 (GMT)
committerChengyi Zhao <chengyi1.zhao@archermind.com>2014-11-08 06:16:13 (GMT)
commit9235632fd02062efa3a1af7eb1957fdd364f4a8c (patch)
tree775df898e509c023834af01d5ef68e8c0646546f
parent37cbead2d2cbea4b9bd9f7180caf26a4b653662d (diff)
downloadconnman-9235632fd02062efa3a1af7eb1957fdd364f4a8c.zip
connman-9235632fd02062efa3a1af7eb1957fdd364f4a8c.tar.gz
connman-9235632fd02062efa3a1af7eb1957fdd364f4a8c.tar.bz2
multi-user: Add multi-user support in managerrefs/changes/14/29714/3
Use case: Given 2 users: UserA and UserB If UserA is connected to a wifi service, then UserB is not allowed to turn on offline mode. Change-Id: I54b108beb580a805c7fa2d3ae9dac192b836ba77
-rw-r--r--src/manager.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/manager.c b/src/manager.c
index d15ce20..bd52f39 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -102,6 +102,20 @@ static DBusMessage *set_property(DBusConnection *conn,
dbus_message_iter_get_basic(&value, &offlinemode);
+ if (offlinemode) {
+ uid_t uid;
+ if (connman_dbus_get_connection_unix_user_sync(conn,
+ dbus_message_get_sender(msg),
+ &uid) < 0) {
+ DBG("Can not get unix user id!");
+ return __connman_error_permission_denied(msg);
+ }
+
+ if (!__connman_service_is_user_allowed(CONNMAN_SERVICE_TYPE_WIFI, uid)) {
+ DBG("Not allow this user to turn on offlinemode now!");
+ return __connman_error_permission_denied(msg);
+ }
+ }
__connman_technology_set_offlinemode(offlinemode);
} else if (g_str_equal(name, "SessionMode")) {