diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2017-05-24 07:49:53 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2017-05-24 07:49:53 +0200 |
commit | dcbb5015626190528a160b4bf93ba18e72c48fff (patch) | |
tree | 5cccf49af1755a00decff42d20fd0cdb9f282cf6 /gitlab/v4/objects.py | |
parent | 8e4b65fc78f47a2be658b11ae30f84da66b13c2a (diff) | |
download | gitlab-v4_support.tar.gz |
[v4] User: drop the manager filtersv4_support
Diffstat (limited to 'gitlab/v4/objects.py')
-rw-r--r-- | gitlab/v4/objects.py | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index eb3a579..6e6c759 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -124,6 +124,8 @@ class UserProjectManager(BaseManager): class User(GitlabObject): _url = '/users' shortPrintAttr = 'username' + optionalListAttrs = ['active', 'blocked', 'username', 'extern_uid', + 'provider', 'external'] requiredCreateAttrs = ['email', 'username', 'name'] optionalCreateAttrs = ['password', 'reset_password', 'skype', 'linkedin', 'twitter', 'projects_limit', 'extern_uid', @@ -175,46 +177,6 @@ class User(GitlabObject): class UserManager(BaseManager): obj_cls = User - def search(self, query, **kwargs): - """Search users. - - Args: - query (str): The query string to send to GitLab for the search. - all (bool): If True, return all the items, without pagination - **kwargs: Additional arguments to send to GitLab. - - Returns: - list(User): A list of matching users. - - Raises: - GitlabConnectionError: If the server cannot be reached. - GitlabListError: If the server fails to perform the request. - """ - url = self.obj_cls._url + '?search=' + query - return self.gitlab._raw_list(url, self.obj_cls, **kwargs) - - def get_by_username(self, username, **kwargs): - """Get a user by its username. - - Args: - username (str): The name of the user. - **kwargs: Additional arguments to send to GitLab. - - Returns: - User: The matching user. - - Raises: - GitlabConnectionError: If the server cannot be reached. - GitlabGetError: If the server fails to perform the request. - """ - url = self.obj_cls._url + '?username=' + username - results = self.gitlab._raw_list(url, self.obj_cls, **kwargs) - assert len(results) in (0, 1) - try: - return results[0] - except IndexError: - raise GitlabGetError('no such user: ' + username) - class CurrentUserEmail(GitlabObject): _url = '/user/emails' |