##// END OF EJS Templates
API updates...
marcink -
r2009:b63adad7 beta
parent child Browse files
Show More
@@ -111,7 +111,7 b' OUTPUT::'
111 111 "email" : "<email>",
112 112 "active" : "<bool>",
113 113 "admin" :  "<bool>",
114 "ldap" : "<ldap_dn>"
114 "ldap_dn" : "<ldap_dn>"
115 115 }
116 116
117 117 error: null
@@ -141,7 +141,7 b' OUTPUT::'
141 141 "email" : "<email>",
142 142 "active" : "<bool>",
143 143 "admin" :  "<bool>",
144 "ldap" : "<ldap_dn>"
144 "ldap_dn" : "<ldap_dn>"
145 145 },
146 146
147 147 ]
@@ -191,14 +191,15 b' INPUT::'
191 191 api_key : "<api_key>"
192 192 method : "update_user"
193 193 args : {
194 "userid" : "<user_id or username>",
194 195 "username" : "<username>",
195 196 "password" : "<password>",
196 197 "email" : "<useremail>",
197 "firstname" : "<firstname> = None",
198 "lastname" : "<lastname> = None",
199 "active" : "<bool> = True",
200 "admin" : "<bool> = False",
201 "ldap_dn" : "<ldap_dn> = None"
198 "firstname" : "<firstname>",
199 "lastname" : "<lastname>",
200 "active" : "<bool>",
201 "admin" : "<bool>",
202 "ldap_dn" : "<ldap_dn>"
202 203 }
203 204
204 205 OUTPUT::
@@ -100,7 +100,7 b' class ApiController(JSONRPCController):'
100 100 email=user.email,
101 101 active=user.active,
102 102 admin=user.admin,
103 ldap=user.ldap_dn
103 ldap_dn=user.ldap_dn
104 104 )
105 105
106 106 @HasPermissionAllDecorator('hg.admin')
@@ -122,7 +122,7 b' class ApiController(JSONRPCController):'
122 122 email=user.email,
123 123 active=user.active,
124 124 admin=user.admin,
125 ldap=user.ldap_dn
125 ldap_dn=user.ldap_dn
126 126 )
127 127 )
128 128 return result
@@ -168,8 +168,8 b' class ApiController(JSONRPCController):'
168 168 raise JSONRPCError('failed to create user %s' % username)
169 169
170 170 @HasPermissionAllDecorator('hg.admin')
171 def update_user(self, apiuser, username, password, email, firstname=None,
172 lastname=None, active=True, admin=False, ldap_dn=None):
171 def update_user(self, apiuser, userid, username, password, email,
172 firstname, lastname, active, admin, ldap_dn):
173 173 """
174 174 Updates given user
175 175
@@ -183,7 +183,7 b' class ApiController(JSONRPCController):'
183 183 :param admin:
184 184 :param ldap_dn:
185 185 """
186 if not User.get_by_username(username):
186 if not UserModel().get_user(userid):
187 187 raise JSONRPCError("user %s does not exist" % username)
188 188
189 189 try:
@@ -74,6 +74,9 b' class UserModel(BaseModel):'
74 74 "get_user_%s" % user_id))
75 75 return user.get(user_id)
76 76
77 def get_user(self, user):
78 return self.__get_user(user)
79
77 80 def get_by_username(self, username, cache=False, case_insensitive=False):
78 81
79 82 if case_insensitive:
General Comments 0
You need to be logged in to leave comments. Login now