From: S.Çağlar Onur Date: Tue, 16 Nov 2010 19:53:45 +0000 (-0500) Subject: Merge branch 'master' into memcache X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=refs%2Fheads%2Fmemcache;hp=de29d2f993c9766712510ace97d5e7519a8521f0;p=plcapi.git Merge branch 'master' into memcache --- diff --git a/PLC/Methods/GetSlivers.py b/PLC/Methods/GetSlivers.py index a8ee408..d54784d 100644 --- a/PLC/Methods/GetSlivers.py +++ b/PLC/Methods/GetSlivers.py @@ -123,6 +123,24 @@ def get_slivers(api, auth, slice_filter, node = None): return slivers +### The pickle module, used in conjunction with caching has a restriction that it does not +### work on "connection objects." It doesn't matter if the connection object has +### an 'str' or 'repr' method, there is a taint check that throws an exception if +### the pickled class is found to derive from a connection. +### (To be moved to Method.py) + +def sanitize_for_pickle (obj): + if (isinstance(obj, dict)): + parent = dict(obj) + for k in parent.keys(): parent[k] = sanitize_for_pickle (parent[k]) + return parent + elif (isinstance(obj, list)): + parent = list(obj) + parent = map(sanitize_for_pickle, parent) + return parent + else: + return obj + class GetSlivers(Method): """ Returns a struct containing information about the specified node diff --git a/PLC/Methods/UpdatePersonTag.py b/PLC/Methods/UpdatePersonTag.py index e07f873..804d17d 100644 --- a/PLC/Methods/UpdatePersonTag.py +++ b/PLC/Methods/UpdatePersonTag.py @@ -53,10 +53,10 @@ class UpdatePersonTag(Method): # check permission : it not admin, is the user affiliated with the right person if 'admin' not in self.caller['roles']: # check caller is affiliated with this person's person - if len(set(person['person_ids']) & set(self.caller['person_ids'])) == 0: + if not self.caller.can_update(person): raise PLCPermissionDenied, "Not a member of the person's persons: %s"%person['person_ids'] - required_min_role = tag_type ['min_role_id'] + required_min_role = person_tag['min_role_id'] if required_min_role is not None and \ min(self.caller['role_ids']) > required_min_role: raise PLCPermissionDenied, "Not allowed to modify the specified person setting, requires role %d",required_min_role