[rygel/wip/acl: 305/306] WIP



commit 06ad359e690e1128a58dab72ecc66cc11c825ed1
Author: Jens Georg <mail jensge org>
Date:   Sun Nov 9 11:48:53 2014 +0100

    WIP

 src/rygel/acl-provider.vala |   32 ++++++++++++++++++++++-
 src/rygel/acl-store.vala    |   59 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 87 insertions(+), 4 deletions(-)
---
diff --git a/src/rygel/acl-provider.vala b/src/rygel/acl-provider.vala
index 8648c0a..52c8efb 100644
--- a/src/rygel/acl-provider.vala
+++ b/src/rygel/acl-provider.vala
@@ -1,5 +1,33 @@
+/*
+ * Copyright (C) 2014 Jens Georg <mail jensge org>
+ *
+ * Author: Jens Georg <mail jensge org>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+internal class Rygel.Acl.Provider : DBusAclProvider, Object {
+    private Storage storage;
+
+    public override void constructed () {
+        base.constructed ();
+        this.storage = new Storage ();
+    }
 
-public class Rygel.AclProvider : DBusAclProvider, Object {
     public async bool is_allowed (GLib.HashTable<string, string> device,
                                   GLib.HashTable<string, string> service,
                                   string path,
@@ -70,6 +98,6 @@ public class Rygel.AclProvider : DBusAclProvider, Object {
     }
 
     public static int main (string[] args) {
-        return new AclProvider().run();
+        return new Provider ().run ();
     }
 }
diff --git a/src/rygel/acl-store.vala b/src/rygel/acl-store.vala
index 6ad2ac2..954390a 100644
--- a/src/rygel/acl-store.vala
+++ b/src/rygel/acl-store.vala
@@ -1,4 +1,59 @@
-internal class Rygel.AclStorage : Object {
-    public AclStorage () {
+/*
+ * Copyright (C) 2014 Jens Georg <mail jensge org>
+ *
+ * Author: Jens Georg <mail jensge org>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+enum Rygel.Acl.Policy {
+    ALLOW,
+    DENY
+}
+
+enum Rygel.Acl.Action {
+    UNKNOWN,
+    EVENT_SUBSCRIPTION,
+    CONTROL_ACCESS
+}
+
+internal class Rygel.Acl.Storage : Object {
+
+    public Storage () {
+        Object();
+    }
+
+    public Policy get_default_policy () {
+        return Policy.ALLOW;
+    }
+
+    public async bool is_allowed (GLib.HashTable<string, string> device,
+                                  GLib.HashTable<string, string> service,
+                                  string path,
+                                  string address,
+                                  string? agent) {
+        Idle.add (() => { is_allowed.callback (); return false; });
+        yield;
+
+
+        if (this.get_default_policy () == Policy.ALLOW) {
+            return true;
+        }
+
+        return false;
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]