From a53fbab16e438c645bd6ea694e6750d1d4d6064b Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Wed, 22 Oct 2008 20:51:40 +0000 Subject: [PATCH] support user created conf files --- PLC/Methods/DeleteConfFile.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PLC/Methods/DeleteConfFile.py b/PLC/Methods/DeleteConfFile.py index f05ae43f..0d97c86d 100644 --- a/PLC/Methods/DeleteConfFile.py +++ b/PLC/Methods/DeleteConfFile.py @@ -11,7 +11,7 @@ class DeleteConfFile(Method): specified configuration files will be queried. """ - roles = ['admin'] + roles = ['admin', 'pi', 'user'] accepts = [ Auth(), @@ -25,8 +25,12 @@ class DeleteConfFile(Method): conf_files = ConfFiles(self.api, [conf_file_id]) if not conf_files: raise PLCInvalidArgument, "No such configuration file" - conf_file = conf_files[0] + + if 'admin' not in self.caller['roles']: + if conf_file['creator_id'] not in [self.caller['site_ids']]: + raise PLCPermissionDenied, "You must be the creator of this conf file." + conf_file.delete() self.event_objects = {'ConfFile': [conf_file['conf_file_id']]} -- 2.45.2