From: Mark Huang Date: Fri, 20 Oct 2006 00:38:38 +0000 (+0000) Subject: use Role X-Git-Tag: pycurl-7_13_1~519 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=4b0c1d88b8ba45137ac363c65d0cf4c2b87ea1ab;p=plcapi.git use Role --- diff --git a/PLC/Methods/AddRoleToPerson.py b/PLC/Methods/AddRoleToPerson.py index 2c63d5ec..bfe68178 100644 --- a/PLC/Methods/AddRoleToPerson.py +++ b/PLC/Methods/AddRoleToPerson.py @@ -3,14 +3,14 @@ from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Persons import Person, Persons from PLC.Auth import PasswordAuth -from PLC.Roles import Roles +from PLC.Roles import Role, Roles class AddRoleToPerson(Method): """ Grants the specified role to the person. PIs can only grant the tech and user roles to users and techs at - their sites. ins can grant any role to any user. + their sites. Admins can grant any role to any user. Returns 1 if successful, faults otherwise. """ @@ -19,15 +19,15 @@ class AddRoleToPerson(Method): accepts = [ PasswordAuth(), + Mixed(Role.fields['role_id'], + Role.fields['name']), Mixed(Person.fields['person_id'], Person.fields['email']), - Mixed(Parameter(int, "Role identifier"), - Parameter(str, "Role name")) ] returns = Parameter(int, '1 if successful') - def call(self, auth, person_id_or_email, role_id_or_name): + def call(self, auth, role_id_or_name, person_id_or_email): # Get all roles roles = {} for role_id, role in Roles(self.api).iteritems():