X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FAddRole.py;h=a801310d77f5add9a8601356a7ef7f24576c1996;hb=06ea74f924fac116f2d89ea77b979dcdf6c7abef;hp=109374c98a37b6bc56c65c49532e6422dbe977f6;hpb=a8e81964a7b22a0584667a0449604cccc895955a;p=plcapi.git diff --git a/PLC/Methods/AddRole.py b/PLC/Methods/AddRole.py index 109374c..a801310 100644 --- a/PLC/Methods/AddRole.py +++ b/PLC/Methods/AddRole.py @@ -1,8 +1,9 @@ +# $Id$ from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Roles import Role, Roles -from PLC.Auth import PasswordAuth +from PLC.Auth import Auth class AddRole(Method): """ @@ -14,17 +15,19 @@ class AddRole(Method): roles = ['admin'] accepts = [ - PasswordAuth(), + Auth(), Role.fields['role_id'], Role.fields['name'] ] returns = Parameter(int, '1 if successful') + def call(self, auth, role_id, name): role = Role(self.api) role['role_id'] = role_id role['name'] = name role.sync(insert = True) + self.event_objects = {'Role': [role['role_id']]} return 1