From 3c00321c3c50cf2b7a1e6c927fed61e7ef3fe2c0 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Tue, 10 Oct 2006 21:58:55 +0000 Subject: [PATCH] - added enabled to list of vaild update fields --- PLC/Methods/UpdatePerson.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/PLC/Methods/UpdatePerson.py b/PLC/Methods/UpdatePerson.py index 140b5632..d45a6044 100644 --- a/PLC/Methods/UpdatePerson.py +++ b/PLC/Methods/UpdatePerson.py @@ -24,7 +24,8 @@ class UpdatePerson(Method): can_update = lambda (field, value): field in \ ['first_name', 'last_name', 'title', 'email', - 'password', 'phone', 'url', 'bio', 'accepted_aup'] + 'password', 'phone', 'url', 'bio', 'accepted_aup', + 'enabled'] update_fields = dict(filter(can_update, Person.fields.items())) accepts = [ @@ -37,7 +38,13 @@ class UpdatePerson(Method): returns = Parameter(int, '1 if successful') def call(self, auth, person_id_or_email, update_fields): - if filter(lambda field: field not in self.update_fields, update_fields): + valid_fields = self.update_fields + # Remove admin only fields + if 'admin' not in self.caller['roles']: + for key in ['enabled']: + valid_fields.remove(key) + + if filter(lambda field: field not in valid_fields, update_fields): raise PLCInvalidArgument, "Invalid field specified" # Get account information -- 2.47.0