@@ -124,6 +124,8 @@ class UserProjectManager(BaseManager):
124
124
class User (GitlabObject ):
125
125
_url = '/users'
126
126
shortPrintAttr = 'username'
127
+ optionalListAttrs = ['active' , 'blocked' , 'username' , 'extern_uid' ,
128
+ 'provider' , 'external' ]
127
129
requiredCreateAttrs = ['email' , 'username' , 'name' ]
128
130
optionalCreateAttrs = ['password' , 'reset_password' , 'skype' , 'linkedin' ,
129
131
'twitter' , 'projects_limit' , 'extern_uid' ,
@@ -175,46 +177,6 @@ def __eq__(self, other):
175
177
class UserManager (BaseManager ):
176
178
obj_cls = User
177
179
178
- def search (self , query , ** kwargs ):
179
- """Search users.
180
-
181
- Args:
182
- query (str): The query string to send to GitLab for the search.
183
- all (bool): If True, return all the items, without pagination
184
- **kwargs: Additional arguments to send to GitLab.
185
-
186
- Returns:
187
- list(User): A list of matching users.
188
-
189
- Raises:
190
- GitlabConnectionError: If the server cannot be reached.
191
- GitlabListError: If the server fails to perform the request.
192
- """
193
- url = self .obj_cls ._url + '?search=' + query
194
- return self .gitlab ._raw_list (url , self .obj_cls , ** kwargs )
195
-
196
- def get_by_username (self , username , ** kwargs ):
197
- """Get a user by its username.
198
-
199
- Args:
200
- username (str): The name of the user.
201
- **kwargs: Additional arguments to send to GitLab.
202
-
203
- Returns:
204
- User: The matching user.
205
-
206
- Raises:
207
- GitlabConnectionError: If the server cannot be reached.
208
- GitlabGetError: If the server fails to perform the request.
209
- """
210
- url = self .obj_cls ._url + '?username=' + username
211
- results = self .gitlab ._raw_list (url , self .obj_cls , ** kwargs )
212
- assert len (results ) in (0 , 1 )
213
- try :
214
- return results [0 ]
215
- except IndexError :
216
- raise GitlabGetError ('no such user: ' + username )
217
-
218
180
219
181
class CurrentUserEmail (GitlabObject ):
220
182
_url = '/user/emails'
0 commit comments