|
1 | | -##### |
| 1 | +###################### |
| 2 | +Users and current user |
| 3 | +###################### |
| 4 | + |
| 5 | +The Gitlab API exposes user-related method that can be manipulated by admins |
| 6 | +only. |
| 7 | + |
| 8 | +The currently logged-in user is also exposed. |
| 9 | + |
2 | 10 | Users |
3 | | -##### |
| 11 | +===== |
| 12 | + |
| 13 | +References |
| 14 | +---------- |
| 15 | + |
| 16 | +* v4 API: |
| 17 | + |
| 18 | + + :class:`gitlab.v4.objects.User` |
| 19 | + + :class:`gitlab.v4.objects.UserManager` |
| 20 | + + :attr:`gitlab.Gitlab.users` |
4 | 21 |
|
5 | | -Use :class:`~gitlab.objects.User` objects to manipulate repository branches. |
| 22 | +* v3 API: |
6 | 23 |
|
7 | | -To create :class:`~gitlab.objects.User` objects use the |
8 | | -:attr:`gitlab.Gitlab.users` manager. |
| 24 | + + :class:`gitlab.v3.objects.User` |
| 25 | + + :class:`gitlab.v3.objects.UserManager` |
| 26 | + + :attr:`gitlab.Gitlab.users` |
9 | 27 |
|
10 | 28 | Examples |
11 | | -======== |
| 29 | +-------- |
12 | 30 |
|
13 | 31 | Get the list of users: |
14 | 32 |
|
@@ -52,14 +70,97 @@ Block/Unblock a user: |
52 | 70 | :start-after: # block |
53 | 71 | :end-before: # end block |
54 | 72 |
|
| 73 | +Current User |
| 74 | +============ |
| 75 | + |
| 76 | +* v4 API: |
| 77 | + |
| 78 | + + :class:`gitlab.v4.objects.CurrentUser` |
| 79 | + + :class:`gitlab.v4.objects.CurrentUserManager` |
| 80 | + + :attr:`gitlab.Gitlab.user` |
| 81 | + |
| 82 | +* v3 API: |
| 83 | + |
| 84 | + + :class:`gitlab.v3.objects.CurrentUser` |
| 85 | + + :class:`gitlab.v3.objects.CurrentUserManager` |
| 86 | + + :attr:`gitlab.Gitlab.user` |
| 87 | + |
| 88 | +Examples |
| 89 | +-------- |
| 90 | + |
| 91 | +Get the current user: |
| 92 | + |
| 93 | +.. literalinclude:: users.py |
| 94 | + :start-after: # currentuser get |
| 95 | + :end-before: # end currentuser get |
| 96 | + |
| 97 | +GPG keys |
| 98 | +======== |
| 99 | + |
| 100 | +You can manipulate GPG keys for the current user and for the other users if you |
| 101 | +are admin. |
| 102 | + |
| 103 | +* v4 API: |
| 104 | + |
| 105 | + + :class:`gitlab.v4.objects.CurrentUserGPGKey` |
| 106 | + + :class:`gitlab.v4.objects.CurrentUserGPGKeyManager` |
| 107 | + + :attr:`gitlab.v4.objects.CurrentUser.gpgkeys` |
| 108 | + + :class:`gitlab.v4.objects.UserGPGKey` |
| 109 | + + :class:`gitlab.v4.objects.UserGPGKeyManager` |
| 110 | + + :attr:`gitlab.v4.objects.User.gpgkeys` |
| 111 | + |
| 112 | +Exemples |
| 113 | +-------- |
| 114 | + |
| 115 | +List GPG keys for a user: |
| 116 | + |
| 117 | +.. literalinclude:: users.py |
| 118 | + :start-after: # gpgkey list |
| 119 | + :end-before: # end gpgkey list |
| 120 | + |
| 121 | +Get an GPG gpgkey for a user: |
| 122 | + |
| 123 | +.. literalinclude:: users.py |
| 124 | + :start-after: # gpgkey get |
| 125 | + :end-before: # end gpgkey get |
| 126 | + |
| 127 | +Create an GPG gpgkey for a user: |
| 128 | + |
| 129 | +.. literalinclude:: users.py |
| 130 | + :start-after: # gpgkey create |
| 131 | + :end-before: # end gpgkey create |
| 132 | + |
| 133 | +Delete an GPG gpgkey for a user: |
| 134 | + |
| 135 | +.. literalinclude:: users.py |
| 136 | + :start-after: # gpgkey delete |
| 137 | + :end-before: # end gpgkey delete |
| 138 | + |
55 | 139 | SSH keys |
56 | 140 | ======== |
57 | 141 |
|
58 | | -Use the :class:`~gitlab.objects.UserKey` objects to manage user keys. |
| 142 | +You can manipulate SSH keys for the current user and for the other users if you |
| 143 | +are admin. |
| 144 | + |
| 145 | +* v4 API: |
| 146 | + |
| 147 | + + :class:`gitlab.v4.objects.CurrentUserKey` |
| 148 | + + :class:`gitlab.v4.objects.CurrentUserKeyManager` |
| 149 | + + :attr:`gitlab.v4.objects.CurrentUser.keys` |
| 150 | + + :class:`gitlab.v4.objects.UserKey` |
| 151 | + + :class:`gitlab.v4.objects.UserKeyManager` |
| 152 | + + :attr:`gitlab.v4.objects.User.keys` |
59 | 153 |
|
60 | | -To create :class:`~gitlab.objects.UserKey` objects use the |
61 | | -:attr:`User.keys <gitlab.objects.User.keys>` or :attr:`gitlab.Gitlab.user_keys` |
62 | | -managers. |
| 154 | +* v3 API: |
| 155 | + |
| 156 | + + :class:`gitlab.v3.objects.CurrentUserKey` |
| 157 | + + :class:`gitlab.v3.objects.CurrentUserKeyManager` |
| 158 | + + :attr:`gitlab.v3.objects.CurrentUser.keys` |
| 159 | + + :attr:`gitlab.Gitlab.user.keys` |
| 160 | + + :class:`gitlab.v3.objects.UserKey` |
| 161 | + + :class:`gitlab.v3.objects.UserKeyManager` |
| 162 | + + :attr:`gitlab.v3.objects.User.keys` |
| 163 | + + :attr:`gitlab.Gitlab.user_keys` |
63 | 164 |
|
64 | 165 | Exemples |
65 | 166 | -------- |
@@ -91,10 +192,28 @@ Delete an SSH key for a user: |
91 | 192 | Emails |
92 | 193 | ====== |
93 | 194 |
|
94 | | -Use the :class:`~gitlab.objects.UserEmail` objects to manage user emails. |
| 195 | +You can manipulate emails for the current user and for the other users if you |
| 196 | +are admin. |
| 197 | + |
| 198 | +* v4 API: |
| 199 | + |
| 200 | + + :class:`gitlab.v4.objects.CurrentUserEmail` |
| 201 | + + :class:`gitlab.v4.objects.CurrentUserEmailManager` |
| 202 | + + :attr:`gitlab.v4.objects.CurrentUser.emails` |
| 203 | + + :class:`gitlab.v4.objects.UserEmail` |
| 204 | + + :class:`gitlab.v4.objects.UserEmailManager` |
| 205 | + + :attr:`gitlab.v4.objects.User.emails` |
95 | 206 |
|
96 | | -To create :class:`~gitlab.objects.UserEmail` objects use the :attr:`User.emails |
97 | | -<gitlab.objects.User.emails>` or :attr:`gitlab.Gitlab.user_emails` managers. |
| 207 | +* v3 API: |
| 208 | + |
| 209 | + + :class:`gitlab.v3.objects.CurrentUserEmail` |
| 210 | + + :class:`gitlab.v3.objects.CurrentUserEmailManager` |
| 211 | + + :attr:`gitlab.v3.objects.CurrentUser.emails` |
| 212 | + + :attr:`gitlab.Gitlab.user.emails` |
| 213 | + + :class:`gitlab.v3.objects.UserEmail` |
| 214 | + + :class:`gitlab.v3.objects.UserEmailManager` |
| 215 | + + :attr:`gitlab.v3.objects.User.emails` |
| 216 | + + :attr:`gitlab.Gitlab.user_emails` |
98 | 217 |
|
99 | 218 | Exemples |
100 | 219 | -------- |
@@ -122,76 +241,3 @@ Delete an email for a user: |
122 | 241 | .. literalinclude:: users.py |
123 | 242 | :start-after: # email delete |
124 | 243 | :end-before: # end email delete |
125 | | - |
126 | | -Current User |
127 | | -============ |
128 | | - |
129 | | -Use the :class:`~gitlab.objects.CurrentUser` object to get information about |
130 | | -the currently logged-in user. |
131 | | - |
132 | | -Use the :class:`~gitlab.objects.CurrentUserKey` objects to manage user keys. |
133 | | - |
134 | | -To create :class:`~gitlab.objects.CurrentUserKey` objects use the |
135 | | -:attr:`gitlab.objects.CurrentUser.keys <CurrentUser.keys>` manager. |
136 | | - |
137 | | -Use the :class:`~gitlab.objects.CurrentUserEmail` objects to manage user emails. |
138 | | - |
139 | | -To create :class:`~gitlab.objects.CurrentUserEmail` objects use the |
140 | | -:attr:`gitlab.objects.CurrentUser.emails <CurrentUser.emails>` manager. |
141 | | - |
142 | | -Examples |
143 | | --------- |
144 | | - |
145 | | -Get the current user: |
146 | | - |
147 | | -.. literalinclude:: users.py |
148 | | - :start-after: # currentuser get |
149 | | - :end-before: # end currentuser get |
150 | | - |
151 | | -List the current user SSH keys: |
152 | | - |
153 | | -.. literalinclude:: users.py |
154 | | - :start-after: # currentuser key list |
155 | | - :end-before: # end currentuser key list |
156 | | - |
157 | | -Get a key for the current user: |
158 | | - |
159 | | -.. literalinclude:: users.py |
160 | | - :start-after: # currentuser key get |
161 | | - :end-before: # end currentuser key get |
162 | | - |
163 | | -Create a key for the current user: |
164 | | - |
165 | | -.. literalinclude:: users.py |
166 | | - :start-after: # currentuser key create |
167 | | - :end-before: # end currentuser key create |
168 | | - |
169 | | -Delete a key for the current user: |
170 | | - |
171 | | -.. literalinclude:: users.py |
172 | | - :start-after: # currentuser key delete |
173 | | - :end-before: # end currentuser key delete |
174 | | - |
175 | | -List the current user emails: |
176 | | - |
177 | | -.. literalinclude:: users.py |
178 | | - :start-after: # currentuser email list |
179 | | - :end-before: # end currentuser email list |
180 | | - |
181 | | -Get an email for the current user: |
182 | | - |
183 | | -.. literalinclude:: users.py |
184 | | - :start-after: # currentuser email get |
185 | | - :end-before: # end currentuser email get |
186 | | - |
187 | | -Create an email for the current user: |
188 | | - |
189 | | -.. literalinclude:: users.py |
190 | | - :start-after: # currentuser email create |
191 | | - :end-before: # end currentuser email create |
192 | | - |
193 | | -Delete an email for the current user: |
194 | | - |
195 | | -.. literalinclude:: users.py |
196 | | - :start-after: # currentuser email delete |
197 | | - :end-before: # end currentuser email delete |
|
0 commit comments