diff options
author | Jens Georg <mail@jensge.org> | 2014-11-09 11:48:53 +0100 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2018-11-07 11:04:05 +0100 |
commit | 9ad884720f6870e9494e553e866c95e8ae2f582b (patch) | |
tree | c2ba064d01d310d5d1afcde1d0ce4fe1358e3450 | |
parent | a7ea5e232504f495f1113a654bb1363300dac0f9 (diff) | |
download | rygel-wip/acl.tar.gz |
WIPwip/acl
-rw-r--r-- | src/rygel/acl-provider.vala | 32 | ||||
-rw-r--r-- | 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 8648c0a0..52c8efbd 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 6ad2ac2d..954390a8 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; } } |