Skip to content

Commit

Permalink
add a Key() method for User objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauvain Pocentek committed Dec 26, 2013
1 parent e31bb9e commit 1969abb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -9,3 +9,4 @@ Contributors
Daniel Kimsey <dekimsey@ufl.edu>
Erik Weatherwax <erik.weatherwax@xls.xerox.com>
Andrew Austin <aaustin@terremark.com>
Koen Smets <koen.smets@gmail.com>
4 changes: 4 additions & 0 deletions ChangeLog
@@ -1,3 +1,7 @@
Version 0.5

* Add SSH key for user

Version 0.4

* Fix strings encoding (Closes #6)
Expand Down
21 changes: 13 additions & 8 deletions gitlab.py
Expand Up @@ -541,14 +541,6 @@ def json(self):
return json.dumps(self.__dict__, cls=jsonEncoder)


class User(GitlabObject):
_url = '/users'
shortPrintAttr = 'username'
requiredCreateAttrs = ['email', 'password', 'username', 'name']
optionalCreateAttrs = ['skype', 'linkedin', 'twitter', 'projects_limit',
'extern_uid', 'provider', 'bio']


class UserKey(GitlabObject):
_url = '/users/%(user_id)s/keys'
canGet = False
Expand All @@ -558,6 +550,19 @@ class UserKey(GitlabObject):
requiredCreateAttrs = ['user_id', 'title', 'key']


class User(GitlabObject):
_url = '/users'
shortPrintAttr = 'username'
requiredCreateAttrs = ['email', 'password', 'username', 'name']
optionalCreateAttrs = ['skype', 'linkedin', 'twitter', 'projects_limit',
'extern_uid', 'provider', 'bio']

def Key(self, id=None, **kwargs):
return self._getListOrObject(UserKey, id,
user_id=self.id,
**kwargs)


class CurrentUserKey(GitlabObject):
_url = '/user/keys'
canUpdate = False
Expand Down

0 comments on commit 1969abb

Please sign in to comment.