Skip to content

Commit

Permalink
Merge pull request #2125 from python-gitlab/jlvillal/user_docs
Browse files Browse the repository at this point in the history
docs(users): add docs about listing a user's projects
  • Loading branch information
nejch committed Jul 5, 2022
2 parents d15fea0 + 065a1a5 commit 1fbfb22
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion docs/gl_objects/users.rst
Expand Up @@ -192,6 +192,31 @@ Revoke (delete) an impersonation token for a user::
i_t.delete()


User projects
=========================

References
----------

* v4 API:

+ :class:`gitlab.v4.objects.UserProject`
+ :class:`gitlab.v4.objects.UserProjectManager`
+ :attr:`gitlab.v4.objects.User.projects`

* GitLab API: https://docs.gitlab.com/ee/api/projects.html#list-user-projects

List visible projects in the user's namespace::

projects = user.projects.list()

.. note::

Only the projects in the user’s namespace are returned. Projects owned by
the user in any group or subgroups are not returned. An empty list is
returned if a profile is set to private.


User memberships
=========================

Expand All @@ -204,7 +229,7 @@ References
+ :class:`gitlab.v4.objects.UserMembershipManager`
+ :attr:`gitlab.v4.objects.User.memberships`

* GitLab API: https://docs.gitlab.com/ee/api/users.html#user-memberships-admin-only
* GitLab API: https://docs.gitlab.com/ee/api/users.html#user-memberships

List direct memberships for a user::

Expand All @@ -218,6 +243,10 @@ List only direct group memberships::

memberships = user.memberships.list(type='Namespace')

.. note::

This endpoint requires admin access.

Current User
============

Expand Down

0 comments on commit 1fbfb22

Please sign in to comment.