diff --git a/docs/gl_objects/users.rst b/docs/gl_objects/users.rst index e7b15f62f..fca7ca80d 100644 --- a/docs/gl_objects/users.rst +++ b/docs/gl_objects/users.rst @@ -145,6 +145,9 @@ Revoke (delete) an impersonation token for a user: Current User ============ +References +---------- + * v4 API: + :class:`gitlab.v4.objects.CurrentUser` @@ -169,6 +172,9 @@ Get the current user: GPG keys ======== +References +---------- + You can manipulate GPG keys for the current user and for the other users if you are admin. @@ -211,6 +217,9 @@ Delete an GPG gpgkey for a user: SSH keys ======== +References +---------- + You can manipulate SSH keys for the current user and for the other users if you are admin. @@ -264,6 +273,9 @@ Delete an SSH key for a user: Emails ====== +References +---------- + You can manipulate emails for the current user and for the other users if you are admin. @@ -313,3 +325,27 @@ Delete an email for a user: .. literalinclude:: users.py :start-after: # email delete :end-before: # end email delete + +Users activities +================ + +References +---------- + +* v4 only +* admin only + +* v4 API: + + + :class:`gitlab.v4.objects.UserActivities` + + :class:`gitlab.v4.objects.UserActivitiesManager` + + :attr:`gitlab.Gitlab.user_activities` + +Examples +-------- + +Get the users activities: + +.. code-block:: python + + activities = gl.user_activities.list(all=True, as_list=False) diff --git a/gitlab/__init__.py b/gitlab/__init__.py index c0f93bf4f..aac483728 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -125,6 +125,7 @@ def __init__(self, url, private_token=None, oauth_token=None, email=None, self.teams = objects.TeamManager(self) else: self.dockerfiles = objects.DockerfileManager(self) + self.user_activities = objects.UserActivitiesManager(self) if self._api_version == '3': # build the "submanagers" diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index de8ec070a..18e208b10 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -112,6 +112,15 @@ def compound_metrics(self, **kwargs): return self.gitlab.http_get('/sidekiq/compound_metrics', **kwargs) +class UserActivities(RESTObject): + _id_attr = 'username' + + +class UserActivitiesManager(ListMixin, RESTManager): + _path = '/user/activities' + _obj_cls = UserActivities + + class UserCustomAttribute(ObjectDeleteMixin, RESTObject): _id_attr = 'key' diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index 7d769f312..cb199b70b 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -580,3 +580,6 @@ content = snippet.content() assert(content == 'import gitlab') snippet.delete() + +# user activities +gl.user_activities.list()