From: Mark Huang Date: Wed, 11 Oct 2006 20:14:18 +0000 (+0000) Subject: - fix pcu@site check X-Git-Tag: pycurl-7_13_1~598 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=af5644b603a81681801771f996f82a39cf01c081;p=plcapi.git - fix pcu@site check --- diff --git a/PLC/Methods/DeletePCU.py b/PLC/Methods/DeletePCU.py index 7099b89d..a6320ed1 100644 --- a/PLC/Methods/DeletePCU.py +++ b/PLC/Methods/DeletePCU.py @@ -30,15 +30,14 @@ class DeletePCU(Method): pcu = pcus[0] if 'admin' not in self.caller['roles']: - if not pcu_ids: - ok = False - sites = Sites(self.api, self.caller['site_ids']).values() - for site in sites: - if pcu['pcu_id'] in site['pcu_ids']: - ok = True - break - if not ok: - raise PLCPermissionDenied, "Not allowed to delete that PCU" + ok = False + sites = Sites(self.api, self.caller['site_ids']).values() + for site in sites: + if pcu['pcu_id'] in site['pcu_ids']: + ok = True + break + if not ok: + raise PLCPermissionDenied, "Not allowed to delete that PCU" pcu.delete() diff --git a/PLC/Methods/UpdatePCU.py b/PLC/Methods/UpdatePCU.py index 0d20feb3..b338d7eb 100644 --- a/PLC/Methods/UpdatePCU.py +++ b/PLC/Methods/UpdatePCU.py @@ -40,15 +40,14 @@ class UpdatePCU(Method): pcu = pcus[0] if 'admin' not in self.caller['roles']: - if not pcu_ids: - ok = False - sites = Sites(self.api, self.caller['site_ids']).values() - for site in sites: - if pcu['pcu_id'] in site['pcu_ids']: - ok = True - break - if not ok: - raise PLCPermissionDenied, "Not allowed to update that PCU" + ok = False + sites = Sites(self.api, self.caller['site_ids']).values() + for site in sites: + if pcu['pcu_id'] in site['pcu_ids']: + ok = True + break + if not ok: + raise PLCPermissionDenied, "Not allowed to update that PCU" pcu.update(pcu_fields) pcu.sync()