summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog4
-rw-r--r--gitlab.py21
3 files changed, 18 insertions, 8 deletions
diff --git a/AUTHORS b/AUTHORS
index 635ddd8..1ef4b2b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -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>
diff --git a/ChangeLog b/ChangeLog
index 9da1715..ec12299 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Version 0.5
+
+ * Add SSH key for user
+
Version 0.4
* Fix strings encoding (Closes #6)
diff --git a/gitlab.py b/gitlab.py
index 368e909..1bd6aff 100644
--- a/gitlab.py
+++ b/gitlab.py
@@ -541,14 +541,6 @@ class GitlabObject(object):
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
@@ -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