##// END OF EJS Templates
docs: updated API documentation.
marcink -
r2508:94401909 default
parent child Browse files
Show More
@@ -1,77 +1,77 b''
1 1 .. _deprecated-methods-ref:
2 2
3 3 deprecated methods
4 4 ==================
5 5
6 6 changeset_comment
7 7 -----------------
8 8
9 9 .. py:function:: changeset_comment(apiuser, repoid, revision, message, userid=<Optional:<OptionalAttr:apiuser>>, status=<Optional:None>)
10 10
11 11 .. deprecated:: 3.4.0
12 12
13 13 Please use method `comment_commit` instead.
14 14
15 15
16 16 Set a changeset comment, and optionally change the status of the
17 17 changeset.
18 18
19 19 This command can only be run using an |authtoken| with admin
20 20 permissions on the |repo|.
21 21
22 22 :param apiuser: This is filled automatically from the |authtoken|.
23 23 :type apiuser: AuthUser
24 24 :param repoid: Set the repository name or repository ID.
25 25 :type repoid: str or int
26 26 :param revision: Specify the revision for which to set a comment.
27 27 :type revision: str
28 28 :param message: The comment text.
29 29 :type message: str
30 30 :param userid: Set the user name of the comment creator.
31 31 :type userid: Optional(str or int)
32 32 :param status: Set the comment status. The following are valid options:
33 33 * not_reviewed
34 34 * approved
35 35 * rejected
36 36 * under_review
37 37 :type status: str
38 38
39 39 Example error output:
40 40
41 .. code-block:: javascript
41 .. code-block:: json
42 42
43 43 {
44 "id" : "<id_given_in_input>",
44 "id" : <id_given_in_input>,
45 45 "result" : {
46 46 "msg": "Commented on commit `<revision>` for repository `<repoid>`",
47 "status_change": null or "<status>",
47 "status_change": null or <status>,
48 48 "success": true
49 49 },
50 50 "error" : null
51 51 }
52 52
53 53
54 54 get_locks
55 55 ---------
56 56
57 57 .. py:function:: get_locks(apiuser, userid=<Optional:<OptionalAttr:apiuser>>)
58 58
59 59 .. deprecated:: 4.0.0
60 60
61 61 Please use method `get_user_locks` instead.
62 62
63 63 None
64 64
65 65
66 66 show_ip
67 67 -------
68 68
69 69 .. py:function:: show_ip(apiuser, userid=<Optional:<OptionalAttr:apiuser>>)
70 70
71 71 .. deprecated:: 4.0.0
72 72
73 73 Please use method `get_ip` instead.
74 74
75 75 None
76 76
77 77
@@ -1,379 +1,421 b''
1 1 .. _pull-request-methods-ref:
2 2
3 3 pull_request methods
4 4 ====================
5 5
6 6 close_pull_request
7 7 ------------------
8 8
9 .. py:function:: close_pull_request(apiuser, repoid, pullrequestid, userid=<Optional:<OptionalAttr:apiuser>>, message=<Optional:''>)
9 .. py:function:: close_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>, message=<Optional:''>)
10 10
11 11 Close the pull request specified by `pullrequestid`.
12 12
13 13 :param apiuser: This is filled automatically from the |authtoken|.
14 14 :type apiuser: AuthUser
15 15 :param repoid: Repository name or repository ID to which the pull
16 16 request belongs.
17 17 :type repoid: str or int
18 18 :param pullrequestid: ID of the pull request to be closed.
19 19 :type pullrequestid: int
20 20 :param userid: Close the pull request as this user.
21 21 :type userid: Optional(str or int)
22 22 :param message: Optional message to close the Pull Request with. If not
23 23 specified it will be generated automatically.
24 24 :type message: Optional(str)
25 25
26 26 Example output:
27 27
28 28 .. code-block:: bash
29 29
30 30 "id": <id_given_in_input>,
31 31 "result": {
32 32 "pull_request_id": "<int>",
33 33 "close_status": "<str:status_lbl>,
34 34 "closed": "<bool>"
35 35 },
36 36 "error": null
37 37
38 38
39 39 comment_pull_request
40 40 --------------------
41 41
42 .. py:function:: comment_pull_request(apiuser, repoid, pullrequestid, message=<Optional:None>, commit_id=<Optional:None>, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
42 .. py:function:: comment_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, message=<Optional:None>, commit_id=<Optional:None>, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
43 43
44 44 Comment on the pull request specified with the `pullrequestid`,
45 45 in the |repo| specified by the `repoid`, and optionally change the
46 46 review status.
47 47
48 48 :param apiuser: This is filled automatically from the |authtoken|.
49 49 :type apiuser: AuthUser
50 :param repoid: The repository name or repository ID.
50 :param repoid: Optional repository name or repository ID.
51 51 :type repoid: str or int
52 52 :param pullrequestid: The pull request ID.
53 53 :type pullrequestid: int
54 54 :param commit_id: Specify the commit_id for which to set a comment. If
55 55 given commit_id is different than latest in the PR status
56 56 change won't be performed.
57 57 :type commit_id: str
58 58 :param message: The text content of the comment.
59 59 :type message: str
60 60 :param status: (**Optional**) Set the approval status of the pull
61 61 request. One of: 'not_reviewed', 'approved', 'rejected',
62 62 'under_review'
63 63 :type status: str
64 64 :param comment_type: Comment type, one of: 'note', 'todo'
65 65 :type comment_type: Optional(str), default: 'note'
66 66 :param userid: Comment on the pull request as this user
67 67 :type userid: Optional(str or int)
68 68
69 69 Example output:
70 70
71 71 .. code-block:: bash
72 72
73 73 id : <id_given_in_input>
74 74 result : {
75 75 "pull_request_id": "<Integer>",
76 76 "comment_id": "<Integer>",
77 77 "status": {"given": <given_status>,
78 78 "was_changed": <bool status_was_actually_changed> },
79 79 },
80 80 error : null
81 81
82 82
83 83 create_pull_request
84 84 -------------------
85 85
86 86 .. py:function:: create_pull_request(apiuser, source_repo, target_repo, source_ref, target_ref, title, description=<Optional:''>, reviewers=<Optional:None>)
87 87
88 88 Creates a new pull request.
89 89
90 90 Accepts refs in the following formats:
91 91
92 92 * branch:<branch_name>:<sha>
93 93 * branch:<branch_name>
94 94 * bookmark:<bookmark_name>:<sha> (Mercurial only)
95 95 * bookmark:<bookmark_name> (Mercurial only)
96 96
97 97 :param apiuser: This is filled automatically from the |authtoken|.
98 98 :type apiuser: AuthUser
99 99 :param source_repo: Set the source repository name.
100 100 :type source_repo: str
101 101 :param target_repo: Set the target repository name.
102 102 :type target_repo: str
103 103 :param source_ref: Set the source ref name.
104 104 :type source_ref: str
105 105 :param target_ref: Set the target ref name.
106 106 :type target_ref: str
107 107 :param title: Set the pull request title.
108 108 :type title: str
109 109 :param description: Set the pull request description.
110 110 :type description: Optional(str)
111 111 :param reviewers: Set the new pull request reviewers list.
112 112 Reviewer defined by review rules will be added automatically to the
113 113 defined list.
114 114 :type reviewers: Optional(list)
115 115 Accepts username strings or objects of the format:
116 116
117 117 [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}]
118 118
119 119
120 120 get_pull_request
121 121 ----------------
122 122
123 .. py:function:: get_pull_request(apiuser, repoid, pullrequestid)
123 .. py:function:: get_pull_request(apiuser, pullrequestid, repoid=<Optional:None>)
124 124
125 125 Get a pull request based on the given ID.
126 126
127 127 :param apiuser: This is filled automatically from the |authtoken|.
128 128 :type apiuser: AuthUser
129 :param repoid: Repository name or repository ID from where the pull
130 request was opened.
129 :param repoid: Optional, repository name or repository ID from where
130 the pull request was opened.
131 131 :type repoid: str or int
132 132 :param pullrequestid: ID of the requested pull request.
133 133 :type pullrequestid: int
134 134
135 135 Example output:
136 136
137 137 .. code-block:: bash
138 138
139 139 "id": <id_given_in_input>,
140 140 "result":
141 141 {
142 142 "pull_request_id": "<pull_request_id>",
143 143 "url": "<url>",
144 144 "title": "<title>",
145 145 "description": "<description>",
146 146 "status" : "<status>",
147 147 "created_on": "<date_time_created>",
148 148 "updated_on": "<date_time_updated>",
149 149 "commit_ids": [
150 150 ...
151 151 "<commit_id>",
152 152 "<commit_id>",
153 153 ...
154 154 ],
155 155 "review_status": "<review_status>",
156 156 "mergeable": {
157 157 "status": "<bool>",
158 158 "message": "<message>",
159 159 },
160 160 "source": {
161 161 "clone_url": "<clone_url>",
162 162 "repository": "<repository_name>",
163 163 "reference":
164 164 {
165 165 "name": "<name>",
166 166 "type": "<type>",
167 167 "commit_id": "<commit_id>",
168 168 }
169 169 },
170 170 "target": {
171 171 "clone_url": "<clone_url>",
172 172 "repository": "<repository_name>",
173 173 "reference":
174 174 {
175 175 "name": "<name>",
176 176 "type": "<type>",
177 177 "commit_id": "<commit_id>",
178 178 }
179 179 },
180 180 "merge": {
181 181 "clone_url": "<clone_url>",
182 182 "reference":
183 183 {
184 184 "name": "<name>",
185 185 "type": "<type>",
186 186 "commit_id": "<commit_id>",
187 187 }
188 188 },
189 189 "author": <user_obj>,
190 190 "reviewers": [
191 191 ...
192 192 {
193 193 "user": "<user_obj>",
194 194 "review_status": "<review_status>",
195 195 }
196 196 ...
197 197 ]
198 198 },
199 199 "error": null
200 200
201 201
202 get_pull_request_comments
203 -------------------------
204
205 .. py:function:: get_pull_request_comments(apiuser, pullrequestid, repoid=<Optional:None>)
206
207 Get all comments of pull request specified with the `pullrequestid`
208
209 :param apiuser: This is filled automatically from the |authtoken|.
210 :type apiuser: AuthUser
211 :param repoid: Optional repository name or repository ID.
212 :type repoid: str or int
213 :param pullrequestid: The pull request ID.
214 :type pullrequestid: int
215
216 Example output:
217
218 .. code-block:: bash
219
220 id : <id_given_in_input>
221 result : [
222 {
223 "comment_author": {
224 "active": true,
225 "full_name_or_username": "Tom Gore",
226 "username": "admin"
227 },
228 "comment_created_on": "2017-01-02T18:43:45.533",
229 "comment_f_path": null,
230 "comment_id": 25,
231 "comment_lineno": null,
232 "comment_status": {
233 "status": "under_review",
234 "status_lbl": "Under Review"
235 },
236 "comment_text": "Example text",
237 "comment_type": null,
238 "pull_request_version": null
239 }
240 ],
241 error : null
242
243
202 244 get_pull_requests
203 245 -----------------
204 246
205 247 .. py:function:: get_pull_requests(apiuser, repoid, status=<Optional:'new'>)
206 248
207 249 Get all pull requests from the repository specified in `repoid`.
208 250
209 251 :param apiuser: This is filled automatically from the |authtoken|.
210 252 :type apiuser: AuthUser
211 :param repoid: Repository name or repository ID.
253 :param repoid: Optional repository name or repository ID.
212 254 :type repoid: str or int
213 255 :param status: Only return pull requests with the specified status.
214 256 Valid options are.
215 257 * ``new`` (default)
216 258 * ``open``
217 259 * ``closed``
218 260 :type status: str
219 261
220 262 Example output:
221 263
222 264 .. code-block:: bash
223 265
224 266 "id": <id_given_in_input>,
225 267 "result":
226 268 [
227 269 ...
228 270 {
229 271 "pull_request_id": "<pull_request_id>",
230 272 "url": "<url>",
231 273 "title" : "<title>",
232 274 "description": "<description>",
233 275 "status": "<status>",
234 276 "created_on": "<date_time_created>",
235 277 "updated_on": "<date_time_updated>",
236 278 "commit_ids": [
237 279 ...
238 280 "<commit_id>",
239 281 "<commit_id>",
240 282 ...
241 283 ],
242 284 "review_status": "<review_status>",
243 285 "mergeable": {
244 286 "status": "<bool>",
245 287 "message: "<message>",
246 288 },
247 289 "source": {
248 290 "clone_url": "<clone_url>",
249 291 "reference":
250 292 {
251 293 "name": "<name>",
252 294 "type": "<type>",
253 295 "commit_id": "<commit_id>",
254 296 }
255 297 },
256 298 "target": {
257 299 "clone_url": "<clone_url>",
258 300 "reference":
259 301 {
260 302 "name": "<name>",
261 303 "type": "<type>",
262 304 "commit_id": "<commit_id>",
263 305 }
264 306 },
265 307 "merge": {
266 308 "clone_url": "<clone_url>",
267 309 "reference":
268 310 {
269 311 "name": "<name>",
270 312 "type": "<type>",
271 313 "commit_id": "<commit_id>",
272 314 }
273 315 },
274 316 "author": <user_obj>,
275 317 "reviewers": [
276 318 ...
277 319 {
278 320 "user": "<user_obj>",
279 321 "review_status": "<review_status>",
280 322 }
281 323 ...
282 324 ]
283 325 }
284 326 ...
285 327 ],
286 328 "error": null
287 329
288 330
289 331 merge_pull_request
290 332 ------------------
291 333
292 .. py:function:: merge_pull_request(apiuser, repoid, pullrequestid, userid=<Optional:<OptionalAttr:apiuser>>)
334 .. py:function:: merge_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
293 335
294 336 Merge the pull request specified by `pullrequestid` into its target
295 337 repository.
296 338
297 339 :param apiuser: This is filled automatically from the |authtoken|.
298 340 :type apiuser: AuthUser
299 :param repoid: The Repository name or repository ID of the
341 :param repoid: Optional, repository name or repository ID of the
300 342 target repository to which the |pr| is to be merged.
301 343 :type repoid: str or int
302 344 :param pullrequestid: ID of the pull request which shall be merged.
303 345 :type pullrequestid: int
304 346 :param userid: Merge the pull request as this user.
305 347 :type userid: Optional(str or int)
306 348
307 349 Example output:
308 350
309 351 .. code-block:: bash
310 352
311 353 "id": <id_given_in_input>,
312 354 "result": {
313 355 "executed": "<bool>",
314 356 "failure_reason": "<int>",
315 357 "merge_commit_id": "<merge_commit_id>",
316 358 "possible": "<bool>",
317 359 "merge_ref": {
318 360 "commit_id": "<commit_id>",
319 361 "type": "<type>",
320 362 "name": "<name>"
321 363 }
322 364 },
323 365 "error": null
324 366
325 367
326 368 update_pull_request
327 369 -------------------
328 370
329 .. py:function:: update_pull_request(apiuser, repoid, pullrequestid, title=<Optional:''>, description=<Optional:''>, reviewers=<Optional:None>, update_commits=<Optional:None>)
371 .. py:function:: update_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, title=<Optional:''>, description=<Optional:''>, reviewers=<Optional:None>, update_commits=<Optional:None>)
330 372
331 373 Updates a pull request.
332 374
333 375 :param apiuser: This is filled automatically from the |authtoken|.
334 376 :type apiuser: AuthUser
335 :param repoid: The repository name or repository ID.
377 :param repoid: Optional repository name or repository ID.
336 378 :type repoid: str or int
337 379 :param pullrequestid: The pull request ID.
338 380 :type pullrequestid: int
339 381 :param title: Set the pull request title.
340 382 :type title: str
341 383 :param description: Update pull request description.
342 384 :type description: Optional(str)
343 385 :param reviewers: Update pull request reviewers list with new value.
344 386 :type reviewers: Optional(list)
345 387 Accepts username strings or objects of the format:
346 388
347 389 [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}]
348 390
349 391 :param update_commits: Trigger update of commits for this pull request
350 392 :type: update_commits: Optional(bool)
351 393
352 394 Example output:
353 395
354 396 .. code-block:: bash
355 397
356 398 id : <id_given_in_input>
357 399 result : {
358 400 "msg": "Updated pull request `63`",
359 401 "pull_request": <pull_request_object>,
360 402 "updated_reviewers": {
361 403 "added": [
362 404 "username"
363 405 ],
364 406 "removed": []
365 407 },
366 408 "updated_commits": {
367 409 "added": [
368 410 "<sha1_hash>"
369 411 ],
370 412 "common": [
371 413 "<sha1_hash>",
372 414 "<sha1_hash>",
373 415 ],
374 416 "removed": []
375 417 }
376 418 }
377 419 error : null
378 420
379 421
@@ -1,358 +1,358 b''
1 1 .. _repo-group-methods-ref:
2 2
3 3 repo_group methods
4 4 ==================
5 5
6 6 create_repo_group
7 7 -----------------
8 8
9 9 .. py:function:: create_repo_group(apiuser, group_name, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, copy_permissions=<Optional:False>)
10 10
11 11 Creates a repository group.
12 12
13 13 * If the repository group name contains "/", repository group will be
14 14 created inside a repository group or nested repository groups
15 15
16 16 For example "foo/bar/group1" will create repository group called "group1"
17 17 inside group "foo/bar". You have to have permissions to access and
18 18 write to the last repository group ("bar" in this example)
19 19
20 20 This command can only be run using an |authtoken| with at least
21 21 permissions to create repository groups, or admin permissions to
22 22 parent repository groups.
23 23
24 24 :param apiuser: This is filled automatically from the |authtoken|.
25 25 :type apiuser: AuthUser
26 26 :param group_name: Set the repository group name.
27 27 :type group_name: str
28 28 :param description: Set the |repo| group description.
29 29 :type description: str
30 30 :param owner: Set the |repo| group owner.
31 31 :type owner: str
32 32 :param copy_permissions:
33 33 :type copy_permissions:
34 34
35 35 Example output:
36 36
37 37 .. code-block:: bash
38 38
39 39 id : <id_given_in_input>
40 40 result : {
41 41 "msg": "Created new repo group `<repo_group_name>`"
42 42 "repo_group": <repogroup_object>
43 43 }
44 44 error : null
45 45
46 46
47 47 Example error output:
48 48
49 49 .. code-block:: bash
50 50
51 51 id : <id_given_in_input>
52 52 result : null
53 53 error : {
54 54 failed to create repo group `<repogroupid>`
55 55 }
56 56
57 57
58 58 delete_repo_group
59 59 -----------------
60 60
61 61 .. py:function:: delete_repo_group(apiuser, repogroupid)
62 62
63 63 Deletes a |repo| group.
64 64
65 65 :param apiuser: This is filled automatically from the |authtoken|.
66 66 :type apiuser: AuthUser
67 67 :param repogroupid: Set the name or ID of repository group to be
68 68 deleted.
69 69 :type repogroupid: str or int
70 70
71 71 Example output:
72 72
73 73 .. code-block:: bash
74 74
75 75 id : <id_given_in_input>
76 76 result : {
77 77 'msg': 'deleted repo group ID:<repogroupid> <repogroupname>'
78 78 'repo_group': null
79 79 }
80 80 error : null
81 81
82 82 Example error output:
83 83
84 84 .. code-block:: bash
85 85
86 86 id : <id_given_in_input>
87 87 result : null
88 88 error : {
89 89 "failed to delete repo group ID:<repogroupid> <repogroupname>"
90 90 }
91 91
92 92
93 93 get_repo_group
94 94 --------------
95 95
96 96 .. py:function:: get_repo_group(apiuser, repogroupid)
97 97
98 98 Return the specified |repo| group, along with permissions,
99 99 and repositories inside the group
100 100
101 101 :param apiuser: This is filled automatically from the |authtoken|.
102 102 :type apiuser: AuthUser
103 103 :param repogroupid: Specify the name of ID of the repository group.
104 104 :type repogroupid: str or int
105 105
106 106
107 107 Example output:
108 108
109 109 .. code-block:: bash
110 110
111 111 {
112 112 "error": null,
113 113 "id": repo-group-id,
114 114 "result": {
115 115 "group_description": "repo group description",
116 116 "group_id": 14,
117 117 "group_name": "group name",
118 "members": [
118 "permissions": [
119 119 {
120 120 "name": "super-admin-username",
121 121 "origin": "super-admin",
122 122 "permission": "group.admin",
123 123 "type": "user"
124 124 },
125 125 {
126 126 "name": "owner-name",
127 127 "origin": "owner",
128 128 "permission": "group.admin",
129 129 "type": "user"
130 130 },
131 131 {
132 132 "name": "user-group-name",
133 133 "origin": "permission",
134 134 "permission": "group.write",
135 135 "type": "user_group"
136 136 }
137 137 ],
138 138 "owner": "owner-name",
139 139 "parent_group": null,
140 140 "repositories": [ repo-list ]
141 141 }
142 142 }
143 143
144 144
145 145 get_repo_groups
146 146 ---------------
147 147
148 148 .. py:function:: get_repo_groups(apiuser)
149 149
150 150 Returns all repository groups.
151 151
152 152 :param apiuser: This is filled automatically from the |authtoken|.
153 153 :type apiuser: AuthUser
154 154
155 155
156 156 grant_user_group_permission_to_repo_group
157 157 -----------------------------------------
158 158
159 159 .. py:function:: grant_user_group_permission_to_repo_group(apiuser, repogroupid, usergroupid, perm, apply_to_children=<Optional:'none'>)
160 160
161 161 Grant permission for a user group on given repository group, or update
162 162 existing permissions if found.
163 163
164 164 This command can only be run using an |authtoken| with admin
165 165 permissions on the |repo| group.
166 166
167 167 :param apiuser: This is filled automatically from the |authtoken|.
168 168 :type apiuser: AuthUser
169 169 :param repogroupid: Set the name or id of repository group
170 170 :type repogroupid: str or int
171 171 :param usergroupid: id of usergroup
172 172 :type usergroupid: str or int
173 173 :param perm: (group.(none|read|write|admin))
174 174 :type perm: str
175 175 :param apply_to_children: 'none', 'repos', 'groups', 'all'
176 176 :type apply_to_children: str
177 177
178 178 Example output:
179 179
180 180 .. code-block:: bash
181 181
182 182 id : <id_given_in_input>
183 183 result : {
184 184 "msg" : "Granted perm: `<perm>` (recursive:<apply_to_children>) for user group: `<usersgroupname>` in repo group: `<repo_group_name>`",
185 185 "success": true
186 186
187 187 }
188 188 error : null
189 189
190 190 Example error output:
191 191
192 192 .. code-block:: bash
193 193
194 194 id : <id_given_in_input>
195 195 result : null
196 196 error : {
197 197 "failed to edit permission for user group: `<usergroup>` in repo group: `<repo_group_name>`"
198 198 }
199 199
200 200
201 201 grant_user_permission_to_repo_group
202 202 -----------------------------------
203 203
204 204 .. py:function:: grant_user_permission_to_repo_group(apiuser, repogroupid, userid, perm, apply_to_children=<Optional:'none'>)
205 205
206 206 Grant permission for a user on the given repository group, or update
207 207 existing permissions if found.
208 208
209 209 This command can only be run using an |authtoken| with admin
210 210 permissions.
211 211
212 212 :param apiuser: This is filled automatically from the |authtoken|.
213 213 :type apiuser: AuthUser
214 214 :param repogroupid: Set the name or ID of repository group.
215 215 :type repogroupid: str or int
216 216 :param userid: Set the user name.
217 217 :type userid: str
218 218 :param perm: (group.(none|read|write|admin))
219 219 :type perm: str
220 220 :param apply_to_children: 'none', 'repos', 'groups', 'all'
221 221 :type apply_to_children: str
222 222
223 223 Example output:
224 224
225 225 .. code-block:: bash
226 226
227 227 id : <id_given_in_input>
228 228 result: {
229 229 "msg" : "Granted perm: `<perm>` (recursive:<apply_to_children>) for user: `<username>` in repo group: `<repo_group_name>`",
230 230 "success": true
231 231 }
232 232 error: null
233 233
234 234 Example error output:
235 235
236 236 .. code-block:: bash
237 237
238 238 id : <id_given_in_input>
239 239 result : null
240 240 error : {
241 241 "failed to edit permission for user: `<userid>` in repo group: `<repo_group_name>`"
242 242 }
243 243
244 244
245 245 revoke_user_group_permission_from_repo_group
246 246 --------------------------------------------
247 247
248 248 .. py:function:: revoke_user_group_permission_from_repo_group(apiuser, repogroupid, usergroupid, apply_to_children=<Optional:'none'>)
249 249
250 250 Revoke permission for user group on given repository.
251 251
252 252 This command can only be run using an |authtoken| with admin
253 253 permissions on the |repo| group.
254 254
255 255 :param apiuser: This is filled automatically from the |authtoken|.
256 256 :type apiuser: AuthUser
257 257 :param repogroupid: name or id of repository group
258 258 :type repogroupid: str or int
259 259 :param usergroupid:
260 260 :param apply_to_children: 'none', 'repos', 'groups', 'all'
261 261 :type apply_to_children: str
262 262
263 263 Example output:
264 264
265 265 .. code-block:: bash
266 266
267 267 id : <id_given_in_input>
268 268 result: {
269 269 "msg" : "Revoked perm (recursive:<apply_to_children>) for user group: `<usersgroupname>` in repo group: `<repo_group_name>`",
270 270 "success": true
271 271 }
272 272 error: null
273 273
274 274 Example error output:
275 275
276 276 .. code-block:: bash
277 277
278 278 id : <id_given_in_input>
279 279 result : null
280 280 error : {
281 281 "failed to edit permission for user group: `<usergroup>` in repo group: `<repo_group_name>`"
282 282 }
283 283
284 284
285 285 revoke_user_permission_from_repo_group
286 286 --------------------------------------
287 287
288 288 .. py:function:: revoke_user_permission_from_repo_group(apiuser, repogroupid, userid, apply_to_children=<Optional:'none'>)
289 289
290 290 Revoke permission for a user in a given repository group.
291 291
292 292 This command can only be run using an |authtoken| with admin
293 293 permissions on the |repo| group.
294 294
295 295 :param apiuser: This is filled automatically from the |authtoken|.
296 296 :type apiuser: AuthUser
297 297 :param repogroupid: Set the name or ID of the repository group.
298 298 :type repogroupid: str or int
299 299 :param userid: Set the user name to revoke.
300 300 :type userid: str
301 301 :param apply_to_children: 'none', 'repos', 'groups', 'all'
302 302 :type apply_to_children: str
303 303
304 304 Example output:
305 305
306 306 .. code-block:: bash
307 307
308 308 id : <id_given_in_input>
309 309 result: {
310 310 "msg" : "Revoked perm (recursive:<apply_to_children>) for user: `<username>` in repo group: `<repo_group_name>`",
311 311 "success": true
312 312 }
313 313 error: null
314 314
315 315 Example error output:
316 316
317 317 .. code-block:: bash
318 318
319 319 id : <id_given_in_input>
320 320 result : null
321 321 error : {
322 322 "failed to edit permission for user: `<userid>` in repo group: `<repo_group_name>`"
323 323 }
324 324
325 325
326 326 update_repo_group
327 327 -----------------
328 328
329 329 .. py:function:: update_repo_group(apiuser, repogroupid, group_name=<Optional:''>, description=<Optional:''>, owner=<Optional:<OptionalAttr:apiuser>>, enable_locking=<Optional:False>)
330 330
331 331 Updates repository group with the details given.
332 332
333 333 This command can only be run using an |authtoken| with admin
334 334 permissions.
335 335
336 336 * If the group_name name contains "/", repository group will be updated
337 337 accordingly with a repository group or nested repository groups
338 338
339 339 For example repogroupid=group-test group_name="foo/bar/group-test"
340 340 will update repository group called "group-test" and place it
341 341 inside group "foo/bar".
342 342 You have to have permissions to access and write to the last repository
343 343 group ("bar" in this example)
344 344
345 345 :param apiuser: This is filled automatically from the |authtoken|.
346 346 :type apiuser: AuthUser
347 347 :param repogroupid: Set the ID of repository group.
348 348 :type repogroupid: str or int
349 349 :param group_name: Set the name of the |repo| group.
350 350 :type group_name: str
351 351 :param description: Set a description for the group.
352 352 :type description: str
353 353 :param owner: Set the |repo| group owner.
354 354 :type owner: str
355 355 :param enable_locking: Enable |repo| locking. The default is false.
356 356 :type enable_locking: bool
357 357
358 358
@@ -1,1047 +1,1024 b''
1 1 .. _repo-methods-ref:
2 2
3 3 repo methods
4 4 ============
5 5
6 6 add_field_to_repo
7 7 -----------------
8 8
9 9 .. py:function:: add_field_to_repo(apiuser, repoid, key, label=<Optional:''>, description=<Optional:''>)
10 10
11 11 Adds an extra field to a repository.
12 12
13 13 This command can only be run using an |authtoken| with at least
14 14 write permissions to the |repo|.
15 15
16 16 :param apiuser: This is filled automatically from the |authtoken|.
17 17 :type apiuser: AuthUser
18 18 :param repoid: Set the repository name or repository id.
19 19 :type repoid: str or int
20 20 :param key: Create a unique field key for this repository.
21 21 :type key: str
22 22 :param label:
23 23 :type label: Optional(str)
24 24 :param description:
25 25 :type description: Optional(str)
26 26
27 27
28 28 comment_commit
29 29 --------------
30 30
31 31 .. py:function:: comment_commit(apiuser, repoid, commit_id, message, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
32 32
33 33 Set a commit comment, and optionally change the status of the commit.
34 34
35 35 :param apiuser: This is filled automatically from the |authtoken|.
36 36 :type apiuser: AuthUser
37 37 :param repoid: Set the repository name or repository ID.
38 38 :type repoid: str or int
39 39 :param commit_id: Specify the commit_id for which to set a comment.
40 40 :type commit_id: str
41 41 :param message: The comment text.
42 42 :type message: str
43 43 :param status: (**Optional**) status of commit, one of: 'not_reviewed',
44 44 'approved', 'rejected', 'under_review'
45 45 :type status: str
46 46 :param comment_type: Comment type, one of: 'note', 'todo'
47 47 :type comment_type: Optional(str), default: 'note'
48 48 :param userid: Set the user name of the comment creator.
49 49 :type userid: Optional(str or int)
50 50
51 51 Example error output:
52 52
53 53 .. code-block:: bash
54 54
55 55 {
56 56 "id" : <id_given_in_input>,
57 57 "result" : {
58 58 "msg": "Commented on commit `<commit_id>` for repository `<repoid>`",
59 59 "status_change": null or <status>,
60 60 "success": true
61 61 },
62 62 "error" : null
63 63 }
64 64
65 65
66 66 create_repo
67 67 -----------
68 68
69 69 .. py:function:: create_repo(apiuser, repo_name, repo_type, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, landing_rev=<Optional:'rev:tip'>, enable_statistics=<Optional:False>, enable_locking=<Optional:False>, enable_downloads=<Optional:False>, copy_permissions=<Optional:False>)
70 70
71 71 Creates a repository.
72 72
73 73 * If the repository name contains "/", repository will be created inside
74 74 a repository group or nested repository groups
75 75
76 76 For example "foo/bar/repo1" will create |repo| called "repo1" inside
77 77 group "foo/bar". You have to have permissions to access and write to
78 78 the last repository group ("bar" in this example)
79 79
80 80 This command can only be run using an |authtoken| with at least
81 81 permissions to create repositories, or write permissions to
82 82 parent repository groups.
83 83
84 84 :param apiuser: This is filled automatically from the |authtoken|.
85 85 :type apiuser: AuthUser
86 86 :param repo_name: Set the repository name.
87 87 :type repo_name: str
88 88 :param repo_type: Set the repository type; 'hg','git', or 'svn'.
89 89 :type repo_type: str
90 90 :param owner: user_id or username
91 91 :type owner: Optional(str)
92 92 :param description: Set the repository description.
93 93 :type description: Optional(str)
94 94 :param private: set repository as private
95 95 :type private: bool
96 96 :param clone_uri: set clone_uri
97 97 :type clone_uri: str
98 98 :param landing_rev: <rev_type>:<rev>
99 99 :type landing_rev: str
100 100 :param enable_locking:
101 101 :type enable_locking: bool
102 102 :param enable_downloads:
103 103 :type enable_downloads: bool
104 104 :param enable_statistics:
105 105 :type enable_statistics: bool
106 106 :param copy_permissions: Copy permission from group in which the
107 107 repository is being created.
108 108 :type copy_permissions: bool
109 109
110 110
111 111 Example output:
112 112
113 113 .. code-block:: bash
114 114
115 115 id : <id_given_in_input>
116 116 result: {
117 117 "msg": "Created new repository `<reponame>`",
118 118 "success": true,
119 119 "task": "<celery task id or None if done sync>"
120 120 }
121 121 error: null
122 122
123 123
124 124 Example error output:
125 125
126 126 .. code-block:: bash
127 127
128 128 id : <id_given_in_input>
129 129 result : null
130 130 error : {
131 131 'failed to create repository `<repo_name>`'
132 132 }
133 133
134 134
135 135 delete_repo
136 136 -----------
137 137
138 138 .. py:function:: delete_repo(apiuser, repoid, forks=<Optional:''>)
139 139
140 140 Deletes a repository.
141 141
142 142 * When the `forks` parameter is set it's possible to detach or delete
143 143 forks of deleted repository.
144 144
145 145 This command can only be run using an |authtoken| with admin
146 146 permissions on the |repo|.
147 147
148 148 :param apiuser: This is filled automatically from the |authtoken|.
149 149 :type apiuser: AuthUser
150 150 :param repoid: Set the repository name or repository ID.
151 151 :type repoid: str or int
152 152 :param forks: Set to `detach` or `delete` forks from the |repo|.
153 153 :type forks: Optional(str)
154 154
155 155 Example error output:
156 156
157 157 .. code-block:: bash
158 158
159 159 id : <id_given_in_input>
160 160 result: {
161 161 "msg": "Deleted repository `<reponame>`",
162 162 "success": true
163 163 }
164 164 error: null
165 165
166 166
167 167 fork_repo
168 168 ---------
169 169
170 170 .. py:function:: fork_repo(apiuser, repoid, fork_name, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, landing_rev=<Optional:'rev:tip'>, copy_permissions=<Optional:False>)
171 171
172 172 Creates a fork of the specified |repo|.
173 173
174 174 * If the fork_name contains "/", fork will be created inside
175 175 a repository group or nested repository groups
176 176
177 177 For example "foo/bar/fork-repo" will create fork called "fork-repo"
178 178 inside group "foo/bar". You have to have permissions to access and
179 179 write to the last repository group ("bar" in this example)
180 180
181 181 This command can only be run using an |authtoken| with minimum
182 182 read permissions of the forked repo, create fork permissions for an user.
183 183
184 184 :param apiuser: This is filled automatically from the |authtoken|.
185 185 :type apiuser: AuthUser
186 186 :param repoid: Set repository name or repository ID.
187 187 :type repoid: str or int
188 188 :param fork_name: Set the fork name, including it's repository group membership.
189 189 :type fork_name: str
190 190 :param owner: Set the fork owner.
191 191 :type owner: str
192 192 :param description: Set the fork description.
193 193 :type description: str
194 194 :param copy_permissions: Copy permissions from parent |repo|. The
195 195 default is False.
196 196 :type copy_permissions: bool
197 197 :param private: Make the fork private. The default is False.
198 198 :type private: bool
199 199 :param landing_rev: Set the landing revision. The default is tip.
200 200
201 201 Example output:
202 202
203 203 .. code-block:: bash
204 204
205 205 id : <id_for_response>
206 206 api_key : "<api_key>"
207 207 args: {
208 208 "repoid" : "<reponame or repo_id>",
209 209 "fork_name": "<forkname>",
210 210 "owner": "<username or user_id = Optional(=apiuser)>",
211 211 "description": "<description>",
212 212 "copy_permissions": "<bool>",
213 213 "private": "<bool>",
214 214 "landing_rev": "<landing_rev>"
215 215 }
216 216
217 217 Example error output:
218 218
219 219 .. code-block:: bash
220 220
221 221 id : <id_given_in_input>
222 222 result: {
223 223 "msg": "Created fork of `<reponame>` as `<forkname>`",
224 224 "success": true,
225 225 "task": "<celery task id or None if done sync>"
226 226 }
227 227 error: null
228 228
229 229
230 230 get_repo
231 231 --------
232 232
233 233 .. py:function:: get_repo(apiuser, repoid, cache=<Optional:True>)
234 234
235 235 Gets an existing repository by its name or repository_id.
236 236
237 237 The members section so the output returns users groups or users
238 238 associated with that repository.
239 239
240 240 This command can only be run using an |authtoken| with admin rights,
241 241 or users with at least read rights to the |repo|.
242 242
243 243 :param apiuser: This is filled automatically from the |authtoken|.
244 244 :type apiuser: AuthUser
245 245 :param repoid: The repository name or repository id.
246 246 :type repoid: str or int
247 247 :param cache: use the cached value for last changeset
248 248 :type: cache: Optional(bool)
249 249
250 250 Example output:
251 251
252 252 .. code-block:: bash
253 253
254 254 {
255 255 "error": null,
256 256 "id": <repo_id>,
257 257 "result": {
258 258 "clone_uri": null,
259 259 "created_on": "timestamp",
260 260 "description": "repo description",
261 261 "enable_downloads": false,
262 262 "enable_locking": false,
263 263 "enable_statistics": false,
264 264 "followers": [
265 265 {
266 266 "active": true,
267 267 "admin": false,
268 268 "api_key": "****************************************",
269 269 "api_keys": [
270 270 "****************************************"
271 271 ],
272 272 "email": "user@example.com",
273 273 "emails": [
274 274 "user@example.com"
275 275 ],
276 276 "extern_name": "rhodecode",
277 277 "extern_type": "rhodecode",
278 278 "firstname": "username",
279 279 "ip_addresses": [],
280 280 "language": null,
281 281 "last_login": "2015-09-16T17:16:35.854",
282 282 "lastname": "surname",
283 283 "user_id": <user_id>,
284 284 "username": "name"
285 285 }
286 286 ],
287 287 "fork_of": "parent-repo",
288 288 "landing_rev": [
289 289 "rev",
290 290 "tip"
291 291 ],
292 292 "last_changeset": {
293 293 "author": "User <user@example.com>",
294 294 "branch": "default",
295 295 "date": "timestamp",
296 296 "message": "last commit message",
297 297 "parents": [
298 298 {
299 299 "raw_id": "commit-id"
300 300 }
301 301 ],
302 302 "raw_id": "commit-id",
303 303 "revision": <revision number>,
304 304 "short_id": "short id"
305 305 },
306 306 "lock_reason": null,
307 307 "locked_by": null,
308 308 "locked_date": null,
309 "members": [
310 {
311 "name": "super-admin-name",
312 "origin": "super-admin",
313 "permission": "repository.admin",
314 "type": "user"
315 },
316 {
317 "name": "owner-name",
318 "origin": "owner",
319 "permission": "repository.admin",
320 "type": "user"
321 },
322 {
323 "name": "user-group-name",
324 "origin": "permission",
325 "permission": "repository.write",
326 "type": "user_group"
327 }
328 ],
329 309 "owner": "owner-name",
330 310 "permissions": [
331 311 {
332 312 "name": "super-admin-name",
333 313 "origin": "super-admin",
334 314 "permission": "repository.admin",
335 315 "type": "user"
336 316 },
337 317 {
338 318 "name": "owner-name",
339 319 "origin": "owner",
340 320 "permission": "repository.admin",
341 321 "type": "user"
342 322 },
343 323 {
344 324 "name": "user-group-name",
345 325 "origin": "permission",
346 326 "permission": "repository.write",
347 327 "type": "user_group"
348 328 }
349 329 ],
350 330 "private": true,
351 331 "repo_id": 676,
352 332 "repo_name": "user-group/repo-name",
353 333 "repo_type": "hg"
354 334 }
355 335 }
356 336
357 337
358 338 get_repo_changeset
359 339 ------------------
360 340
361 341 .. py:function:: get_repo_changeset(apiuser, repoid, revision, details=<Optional:'basic'>)
362 342
363 343 Returns information about a changeset.
364 344
365 345 Additionally parameters define the amount of details returned by
366 346 this function.
367 347
368 348 This command can only be run using an |authtoken| with admin rights,
369 349 or users with at least read rights to the |repo|.
370 350
371 351 :param apiuser: This is filled automatically from the |authtoken|.
372 352 :type apiuser: AuthUser
373 353 :param repoid: The repository name or repository id
374 354 :type repoid: str or int
375 355 :param revision: revision for which listing should be done
376 356 :type revision: str
377 357 :param details: details can be 'basic|extended|full' full gives diff
378 358 info details like the diff itself, and number of changed files etc.
379 359 :type details: Optional(str)
380 360
381 361
382 362 get_repo_changesets
383 363 -------------------
384 364
385 365 .. py:function:: get_repo_changesets(apiuser, repoid, start_rev, limit, details=<Optional:'basic'>)
386 366
387 367 Returns a set of commits limited by the number starting
388 368 from the `start_rev` option.
389 369
390 370 Additional parameters define the amount of details returned by this
391 371 function.
392 372
393 373 This command can only be run using an |authtoken| with admin rights,
394 374 or users with at least read rights to |repos|.
395 375
396 376 :param apiuser: This is filled automatically from the |authtoken|.
397 377 :type apiuser: AuthUser
398 378 :param repoid: The repository name or repository ID.
399 379 :type repoid: str or int
400 380 :param start_rev: The starting revision from where to get changesets.
401 381 :type start_rev: str
402 382 :param limit: Limit the number of commits to this amount
403 383 :type limit: str or int
404 384 :param details: Set the level of detail returned. Valid option are:
405 385 ``basic``, ``extended`` and ``full``.
406 386 :type details: Optional(str)
407 387
408 388 .. note::
409 389
410 390 Setting the parameter `details` to the value ``full`` is extensive
411 391 and returns details like the diff itself, and the number
412 392 of changed files.
413 393
414 394
415 395 get_repo_nodes
416 396 --------------
417 397
418 398 .. py:function:: get_repo_nodes(apiuser, repoid, revision, root_path, ret_type=<Optional:'all'>, details=<Optional:'basic'>, max_file_bytes=<Optional:None>)
419 399
420 400 Returns a list of nodes and children in a flat list for a given
421 401 path at given revision.
422 402
423 403 It's possible to specify ret_type to show only `files` or `dirs`.
424 404
425 405 This command can only be run using an |authtoken| with admin rights,
426 406 or users with at least read rights to |repos|.
427 407
428 408 :param apiuser: This is filled automatically from the |authtoken|.
429 409 :type apiuser: AuthUser
430 410 :param repoid: The repository name or repository ID.
431 411 :type repoid: str or int
432 412 :param revision: The revision for which listing should be done.
433 413 :type revision: str
434 414 :param root_path: The path from which to start displaying.
435 415 :type root_path: str
436 416 :param ret_type: Set the return type. Valid options are
437 417 ``all`` (default), ``files`` and ``dirs``.
438 418 :type ret_type: Optional(str)
439 419 :param details: Returns extended information about nodes, such as
440 420 md5, binary, and or content. The valid options are ``basic`` and
441 421 ``full``.
442 422 :type details: Optional(str)
443 423 :param max_file_bytes: Only return file content under this file size bytes
444 424 :type details: Optional(int)
445 425
446 426 Example output:
447 427
448 428 .. code-block:: bash
449 429
450 430 id : <id_given_in_input>
451 431 result: [
452 432 {
453 433 "name" : "<name>"
454 434 "type" : "<type>",
455 435 "binary": "<true|false>" (only in extended mode)
456 436 "md5" : "<md5 of file content>" (only in extended mode)
457 437 },
458 438 ...
459 439 ]
460 440 error: null
461 441
462 442
463 443 get_repo_refs
464 444 -------------
465 445
466 446 .. py:function:: get_repo_refs(apiuser, repoid)
467 447
468 448 Returns a dictionary of current references. It returns
469 449 bookmarks, branches, closed_branches, and tags for given repository
470 450
471 451 It's possible to specify ret_type to show only `files` or `dirs`.
472 452
473 453 This command can only be run using an |authtoken| with admin rights,
474 454 or users with at least read rights to |repos|.
475 455
476 456 :param apiuser: This is filled automatically from the |authtoken|.
477 457 :type apiuser: AuthUser
478 458 :param repoid: The repository name or repository ID.
479 459 :type repoid: str or int
480 460
481 461 Example output:
482 462
483 463 .. code-block:: bash
484 464
485 465 id : <id_given_in_input>
486 466 "result": {
487 467 "bookmarks": {
488 468 "dev": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
489 469 "master": "367f590445081d8ec8c2ea0456e73ae1f1c3d6cf"
490 470 },
491 471 "branches": {
492 472 "default": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
493 473 "stable": "367f590445081d8ec8c2ea0456e73ae1f1c3d6cf"
494 474 },
495 475 "branches_closed": {},
496 476 "tags": {
497 477 "tip": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
498 478 "v4.4.0": "1232313f9e6adac5ce5399c2a891dc1e72b79022",
499 479 "v4.4.1": "cbb9f1d329ae5768379cdec55a62ebdd546c4e27",
500 480 "v4.4.2": "24ffe44a27fcd1c5b6936144e176b9f6dd2f3a17",
501 481 }
502 482 }
503 483 error: null
504 484
505 485
506 486 get_repo_settings
507 487 -----------------
508 488
509 489 .. py:function:: get_repo_settings(apiuser, repoid, key=<Optional:None>)
510 490
511 491 Returns all settings for a repository. If key is given it only returns the
512 492 setting identified by the key or null.
513 493
514 494 :param apiuser: This is filled automatically from the |authtoken|.
515 495 :type apiuser: AuthUser
516 496 :param repoid: The repository name or repository id.
517 497 :type repoid: str or int
518 498 :param key: Key of the setting to return.
519 499 :type: key: Optional(str)
520 500
521 501 Example output:
522 502
523 503 .. code-block:: bash
524 504
525 505 {
526 506 "error": null,
527 507 "id": 237,
528 508 "result": {
529 509 "extensions_largefiles": true,
530 510 "extensions_evolve": true,
531 511 "hooks_changegroup_push_logger": true,
532 512 "hooks_changegroup_repo_size": false,
533 513 "hooks_outgoing_pull_logger": true,
534 514 "phases_publish": "True",
535 515 "rhodecode_hg_use_rebase_for_merging": true,
536 "rhodecode_hg_close_branch_before_merging": false,
537 "rhodecode_git_use_rebase_for_merging": true,
538 "rhodecode_git_close_branch_before_merging": false,
539 516 "rhodecode_pr_merge_enabled": true,
540 517 "rhodecode_use_outdated_comments": true
541 518 }
542 519 }
543 520
544 521
545 522 get_repos
546 523 ---------
547 524
548 525 .. py:function:: get_repos(apiuser, root=<Optional:None>, traverse=<Optional:True>)
549 526
550 527 Lists all existing repositories.
551 528
552 529 This command can only be run using an |authtoken| with admin rights,
553 530 or users with at least read rights to |repos|.
554 531
555 532 :param apiuser: This is filled automatically from the |authtoken|.
556 533 :type apiuser: AuthUser
557 534 :param root: specify root repository group to fetch repositories.
558 535 filters the returned repositories to be members of given root group.
559 536 :type root: Optional(None)
560 537 :param traverse: traverse given root into subrepositories. With this flag
561 538 set to False, it will only return top-level repositories from `root`.
562 539 if root is empty it will return just top-level repositories.
563 540 :type traverse: Optional(True)
564 541
565 542
566 543 Example output:
567 544
568 545 .. code-block:: bash
569 546
570 547 id : <id_given_in_input>
571 548 result: [
572 549 {
573 550 "repo_id" : "<repo_id>",
574 551 "repo_name" : "<reponame>"
575 552 "repo_type" : "<repo_type>",
576 553 "clone_uri" : "<clone_uri>",
577 554 "private": : "<bool>",
578 555 "created_on" : "<datetimecreated>",
579 556 "description" : "<description>",
580 557 "landing_rev": "<landing_rev>",
581 558 "owner": "<repo_owner>",
582 559 "fork_of": "<name_of_fork_parent>",
583 560 "enable_downloads": "<bool>",
584 561 "enable_locking": "<bool>",
585 562 "enable_statistics": "<bool>",
586 563 },
587 564 ...
588 565 ]
589 566 error: null
590 567
591 568
592 569 grant_user_group_permission
593 570 ---------------------------
594 571
595 572 .. py:function:: grant_user_group_permission(apiuser, repoid, usergroupid, perm)
596 573
597 574 Grant permission for a user group on the specified repository,
598 575 or update existing permissions.
599 576
600 577 This command can only be run using an |authtoken| with admin
601 578 permissions on the |repo|.
602 579
603 580 :param apiuser: This is filled automatically from the |authtoken|.
604 581 :type apiuser: AuthUser
605 582 :param repoid: Set the repository name or repository ID.
606 583 :type repoid: str or int
607 584 :param usergroupid: Specify the ID of the user group.
608 585 :type usergroupid: str or int
609 586 :param perm: Set the user group permissions using the following
610 587 format: (repository.(none|read|write|admin))
611 588 :type perm: str
612 589
613 590 Example output:
614 591
615 592 .. code-block:: bash
616 593
617 594 id : <id_given_in_input>
618 595 result : {
619 596 "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`",
620 597 "success": true
621 598
622 599 }
623 600 error : null
624 601
625 602 Example error output:
626 603
627 604 .. code-block:: bash
628 605
629 606 id : <id_given_in_input>
630 607 result : null
631 608 error : {
632 609 "failed to edit permission for user group: `<usergroup>` in repo `<repo>`'
633 610 }
634 611
635 612
636 613 grant_user_permission
637 614 ---------------------
638 615
639 616 .. py:function:: grant_user_permission(apiuser, repoid, userid, perm)
640 617
641 618 Grant permissions for the specified user on the given repository,
642 619 or update existing permissions if found.
643 620
644 621 This command can only be run using an |authtoken| with admin
645 622 permissions on the |repo|.
646 623
647 624 :param apiuser: This is filled automatically from the |authtoken|.
648 625 :type apiuser: AuthUser
649 626 :param repoid: Set the repository name or repository ID.
650 627 :type repoid: str or int
651 628 :param userid: Set the user name.
652 629 :type userid: str
653 630 :param perm: Set the user permissions, using the following format
654 631 ``(repository.(none|read|write|admin))``
655 632 :type perm: str
656 633
657 634 Example output:
658 635
659 636 .. code-block:: bash
660 637
661 638 id : <id_given_in_input>
662 639 result: {
663 640 "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`",
664 641 "success": true
665 642 }
666 643 error: null
667 644
668 645
669 646 invalidate_cache
670 647 ----------------
671 648
672 649 .. py:function:: invalidate_cache(apiuser, repoid, delete_keys=<Optional:False>)
673 650
674 651 Invalidates the cache for the specified repository.
675 652
676 653 This command can only be run using an |authtoken| with admin rights to
677 654 the specified repository.
678 655
679 656 This command takes the following options:
680 657
681 658 :param apiuser: This is filled automatically from |authtoken|.
682 659 :type apiuser: AuthUser
683 660 :param repoid: Sets the repository name or repository ID.
684 661 :type repoid: str or int
685 662 :param delete_keys: This deletes the invalidated keys instead of
686 663 just flagging them.
687 664 :type delete_keys: Optional(``True`` | ``False``)
688 665
689 666 Example output:
690 667
691 668 .. code-block:: bash
692 669
693 670 id : <id_given_in_input>
694 671 result : {
695 672 'msg': Cache for repository `<repository name>` was invalidated,
696 673 'repository': <repository name>
697 674 }
698 675 error : null
699 676
700 677 Example error output:
701 678
702 679 .. code-block:: bash
703 680
704 681 id : <id_given_in_input>
705 682 result : null
706 683 error : {
707 684 'Error occurred during cache invalidation action'
708 685 }
709 686
710 687
711 688 lock
712 689 ----
713 690
714 691 .. py:function:: lock(apiuser, repoid, locked=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
715 692
716 693 Sets the lock state of the specified |repo| by the given user.
717 694 From more information, see :ref:`repo-locking`.
718 695
719 696 * If the ``userid`` option is not set, the repository is locked to the
720 697 user who called the method.
721 698 * If the ``locked`` parameter is not set, the current lock state of the
722 699 repository is displayed.
723 700
724 701 This command can only be run using an |authtoken| with admin rights to
725 702 the specified repository.
726 703
727 704 This command takes the following options:
728 705
729 706 :param apiuser: This is filled automatically from the |authtoken|.
730 707 :type apiuser: AuthUser
731 708 :param repoid: Sets the repository name or repository ID.
732 709 :type repoid: str or int
733 710 :param locked: Sets the lock state.
734 711 :type locked: Optional(``True`` | ``False``)
735 712 :param userid: Set the repository lock to this user.
736 713 :type userid: Optional(str or int)
737 714
738 715 Example error output:
739 716
740 717 .. code-block:: bash
741 718
742 719 id : <id_given_in_input>
743 720 result : {
744 721 'repo': '<reponame>',
745 722 'locked': <bool: lock state>,
746 723 'locked_since': <int: lock timestamp>,
747 724 'locked_by': <username of person who made the lock>,
748 725 'lock_reason': <str: reason for locking>,
749 726 'lock_state_changed': <bool: True if lock state has been changed in this request>,
750 727 'msg': 'Repo `<reponame>` locked by `<username>` on <timestamp>.'
751 728 or
752 729 'msg': 'Repo `<repository name>` not locked.'
753 730 or
754 731 'msg': 'User `<user name>` set lock state for repo `<repository name>` to `<new lock state>`'
755 732 }
756 733 error : null
757 734
758 735 Example error output:
759 736
760 737 .. code-block:: bash
761 738
762 739 id : <id_given_in_input>
763 740 result : null
764 741 error : {
765 742 'Error occurred locking repository `<reponame>`'
766 743 }
767 744
768 745
769 746 maintenance
770 747 -----------
771 748
772 749 .. py:function:: maintenance(apiuser, repoid)
773 750
774 751 Triggers a maintenance on the given repository.
775 752
776 753 This command can only be run using an |authtoken| with admin
777 754 rights to the specified repository. For more information,
778 755 see :ref:`config-token-ref`.
779 756
780 757 This command takes the following options:
781 758
782 759 :param apiuser: This is filled automatically from the |authtoken|.
783 760 :type apiuser: AuthUser
784 761 :param repoid: The repository name or repository ID.
785 762 :type repoid: str or int
786 763
787 764 Example output:
788 765
789 766 .. code-block:: bash
790 767
791 768 id : <id_given_in_input>
792 769 result : {
793 770 "msg": "executed maintenance command",
794 771 "executed_actions": [
795 772 <action_message>, <action_message2>...
796 773 ],
797 774 "repository": "<repository name>"
798 775 }
799 776 error : null
800 777
801 778 Example error output:
802 779
803 780 .. code-block:: bash
804 781
805 782 id : <id_given_in_input>
806 783 result : null
807 784 error : {
808 785 "Unable to execute maintenance on `<reponame>`"
809 786 }
810 787
811 788
812 789 pull
813 790 ----
814 791
815 792 .. py:function:: pull(apiuser, repoid)
816 793
817 794 Triggers a pull on the given repository from a remote location. You
818 795 can use this to keep remote repositories up-to-date.
819 796
820 797 This command can only be run using an |authtoken| with admin
821 798 rights to the specified repository. For more information,
822 799 see :ref:`config-token-ref`.
823 800
824 801 This command takes the following options:
825 802
826 803 :param apiuser: This is filled automatically from the |authtoken|.
827 804 :type apiuser: AuthUser
828 805 :param repoid: The repository name or repository ID.
829 806 :type repoid: str or int
830 807
831 808 Example output:
832 809
833 810 .. code-block:: bash
834 811
835 812 id : <id_given_in_input>
836 813 result : {
837 814 "msg": "Pulled from `<repository name>`"
838 815 "repository": "<repository name>"
839 816 }
840 817 error : null
841 818
842 819 Example error output:
843 820
844 821 .. code-block:: bash
845 822
846 823 id : <id_given_in_input>
847 824 result : null
848 825 error : {
849 826 "Unable to pull changes from `<reponame>`"
850 827 }
851 828
852 829
853 830 remove_field_from_repo
854 831 ----------------------
855 832
856 833 .. py:function:: remove_field_from_repo(apiuser, repoid, key)
857 834
858 835 Removes an extra field from a repository.
859 836
860 837 This command can only be run using an |authtoken| with at least
861 838 write permissions to the |repo|.
862 839
863 840 :param apiuser: This is filled automatically from the |authtoken|.
864 841 :type apiuser: AuthUser
865 842 :param repoid: Set the repository name or repository ID.
866 843 :type repoid: str or int
867 844 :param key: Set the unique field key for this repository.
868 845 :type key: str
869 846
870 847
871 848 revoke_user_group_permission
872 849 ----------------------------
873 850
874 851 .. py:function:: revoke_user_group_permission(apiuser, repoid, usergroupid)
875 852
876 853 Revoke the permissions of a user group on a given repository.
877 854
878 855 This command can only be run using an |authtoken| with admin
879 856 permissions on the |repo|.
880 857
881 858 :param apiuser: This is filled automatically from the |authtoken|.
882 859 :type apiuser: AuthUser
883 860 :param repoid: Set the repository name or repository ID.
884 861 :type repoid: str or int
885 862 :param usergroupid: Specify the user group ID.
886 863 :type usergroupid: str or int
887 864
888 865 Example output:
889 866
890 867 .. code-block:: bash
891 868
892 869 id : <id_given_in_input>
893 870 result: {
894 871 "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`",
895 872 "success": true
896 873 }
897 874 error: null
898 875
899 876
900 877 revoke_user_permission
901 878 ----------------------
902 879
903 880 .. py:function:: revoke_user_permission(apiuser, repoid, userid)
904 881
905 882 Revoke permission for a user on the specified repository.
906 883
907 884 This command can only be run using an |authtoken| with admin
908 885 permissions on the |repo|.
909 886
910 887 :param apiuser: This is filled automatically from the |authtoken|.
911 888 :type apiuser: AuthUser
912 889 :param repoid: Set the repository name or repository ID.
913 890 :type repoid: str or int
914 891 :param userid: Set the user name of revoked user.
915 892 :type userid: str or int
916 893
917 894 Example error output:
918 895
919 896 .. code-block:: bash
920 897
921 898 id : <id_given_in_input>
922 899 result: {
923 900 "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`",
924 901 "success": true
925 902 }
926 903 error: null
927 904
928 905
929 906 set_repo_settings
930 907 -----------------
931 908
932 909 .. py:function:: set_repo_settings(apiuser, repoid, settings)
933 910
934 911 Update repository settings. Returns true on success.
935 912
936 913 :param apiuser: This is filled automatically from the |authtoken|.
937 914 :type apiuser: AuthUser
938 915 :param repoid: The repository name or repository id.
939 916 :type repoid: str or int
940 917 :param settings: The new settings for the repository.
941 918 :type: settings: dict
942 919
943 920 Example output:
944 921
945 922 .. code-block:: bash
946 923
947 924 {
948 925 "error": null,
949 926 "id": 237,
950 927 "result": true
951 928 }
952 929
953 930
954 931 strip
955 932 -----
956 933
957 934 .. py:function:: strip(apiuser, repoid, revision, branch)
958 935
959 936 Strips the given revision from the specified repository.
960 937
961 938 * This will remove the revision and all of its decendants.
962 939
963 940 This command can only be run using an |authtoken| with admin rights to
964 941 the specified repository.
965 942
966 943 This command takes the following options:
967 944
968 945 :param apiuser: This is filled automatically from the |authtoken|.
969 946 :type apiuser: AuthUser
970 947 :param repoid: The repository name or repository ID.
971 948 :type repoid: str or int
972 949 :param revision: The revision you wish to strip.
973 950 :type revision: str
974 951 :param branch: The branch from which to strip the revision.
975 952 :type branch: str
976 953
977 954 Example output:
978 955
979 956 .. code-block:: bash
980 957
981 958 id : <id_given_in_input>
982 959 result : {
983 960 "msg": "'Stripped commit <commit_hash> from repo `<repository name>`'"
984 961 "repository": "<repository name>"
985 962 }
986 963 error : null
987 964
988 965 Example error output:
989 966
990 967 .. code-block:: bash
991 968
992 969 id : <id_given_in_input>
993 970 result : null
994 971 error : {
995 972 "Unable to strip commit <commit_hash> from repo `<repository name>`"
996 973 }
997 974
998 975
999 976 update_repo
1000 977 -----------
1001 978
1002 979 .. py:function:: update_repo(apiuser, repoid, repo_name=<Optional:None>, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, landing_rev=<Optional:'rev:tip'>, fork_of=<Optional:None>, enable_statistics=<Optional:False>, enable_locking=<Optional:False>, enable_downloads=<Optional:False>, fields=<Optional:''>)
1003 980
1004 981 Updates a repository with the given information.
1005 982
1006 983 This command can only be run using an |authtoken| with at least
1007 984 admin permissions to the |repo|.
1008 985
1009 986 * If the repository name contains "/", repository will be updated
1010 987 accordingly with a repository group or nested repository groups
1011 988
1012 989 For example repoid=repo-test name="foo/bar/repo-test" will update |repo|
1013 990 called "repo-test" and place it inside group "foo/bar".
1014 991 You have to have permissions to access and write to the last repository
1015 992 group ("bar" in this example)
1016 993
1017 994 :param apiuser: This is filled automatically from the |authtoken|.
1018 995 :type apiuser: AuthUser
1019 996 :param repoid: repository name or repository ID.
1020 997 :type repoid: str or int
1021 998 :param repo_name: Update the |repo| name, including the
1022 999 repository group it's in.
1023 1000 :type repo_name: str
1024 1001 :param owner: Set the |repo| owner.
1025 1002 :type owner: str
1026 1003 :param fork_of: Set the |repo| as fork of another |repo|.
1027 1004 :type fork_of: str
1028 1005 :param description: Update the |repo| description.
1029 1006 :type description: str
1030 1007 :param private: Set the |repo| as private. (True | False)
1031 1008 :type private: bool
1032 1009 :param clone_uri: Update the |repo| clone URI.
1033 1010 :type clone_uri: str
1034 1011 :param landing_rev: Set the |repo| landing revision. Default is ``rev:tip``.
1035 1012 :type landing_rev: str
1036 1013 :param enable_statistics: Enable statistics on the |repo|, (True | False).
1037 1014 :type enable_statistics: bool
1038 1015 :param enable_locking: Enable |repo| locking.
1039 1016 :type enable_locking: bool
1040 1017 :param enable_downloads: Enable downloads from the |repo|, (True | False).
1041 1018 :type enable_downloads: bool
1042 1019 :param fields: Add extra fields to the |repo|. Use the following
1043 1020 example format: ``field_key=field_val,field_key2=fieldval2``.
1044 1021 Escape ', ' with \,
1045 1022 :type fields: str
1046 1023
1047 1024
@@ -1,406 +1,412 b''
1 1 .. _user-group-methods-ref:
2 2
3 3 user_group methods
4 4 ==================
5 5
6 6 add_user_to_user_group
7 7 ----------------------
8 8
9 9 .. py:function:: add_user_to_user_group(apiuser, usergroupid, userid)
10 10
11 11 Adds a user to a `user group`. If the user already exists in the group
12 12 this command will return false.
13 13
14 14 This command can only be run using an |authtoken| with admin rights to
15 15 the specified user group.
16 16
17 17 This command takes the following options:
18 18
19 19 :param apiuser: This is filled automatically from the |authtoken|.
20 20 :type apiuser: AuthUser
21 21 :param usergroupid: Set the name of the `user group` to which a
22 22 user will be added.
23 23 :type usergroupid: int
24 24 :param userid: Set the `user_id` of the user to add to the group.
25 25 :type userid: int
26 26
27 27 Example output:
28 28
29 29 .. code-block:: bash
30 30
31 31 id : <id_given_in_input>
32 32 result : {
33 33 "success": True|False # depends on if member is in group
34 34 "msg": "added member `<username>` to user group `<groupname>` |
35 35 User is already in that group"
36 36
37 37 }
38 38 error : null
39 39
40 40 Example error output:
41 41
42 42 .. code-block:: bash
43 43
44 44 id : <id_given_in_input>
45 45 result : null
46 46 error : {
47 47 "failed to add member to user group `<user_group_name>`"
48 48 }
49 49
50 50
51 51 create_user_group
52 52 -----------------
53 53
54 54 .. py:function:: create_user_group(apiuser, group_name, description=<Optional:''>, owner=<Optional:<OptionalAttr:apiuser>>, active=<Optional:True>)
55 55
56 56 Creates a new user group.
57 57
58 58 This command can only be run using an |authtoken| with admin rights to
59 59 the specified repository.
60 60
61 61 This command takes the following options:
62 62
63 63 :param apiuser: This is filled automatically from the |authtoken|.
64 64 :type apiuser: AuthUser
65 65 :param group_name: Set the name of the new user group.
66 66 :type group_name: str
67 67 :param description: Give a description of the new user group.
68 68 :type description: str
69 69 :param owner: Set the owner of the new user group.
70 70 If not set, the owner is the |authtoken| user.
71 71 :type owner: Optional(str or int)
72 72 :param active: Set this group as active.
73 73 :type active: Optional(``True`` | ``False``)
74 74
75 75 Example output:
76 76
77 77 .. code-block:: bash
78 78
79 79 id : <id_given_in_input>
80 80 result: {
81 81 "msg": "created new user group `<groupname>`",
82 82 "user_group": <user_group_object>
83 83 }
84 84 error: null
85 85
86 86 Example error output:
87 87
88 88 .. code-block:: bash
89 89
90 90 id : <id_given_in_input>
91 91 result : null
92 92 error : {
93 93 "user group `<group name>` already exist"
94 94 or
95 95 "failed to create group `<group name>`"
96 96 }
97 97
98 98
99 99 delete_user_group
100 100 -----------------
101 101
102 102 .. py:function:: delete_user_group(apiuser, usergroupid)
103 103
104 104 Deletes the specified `user group`.
105 105
106 106 This command can only be run using an |authtoken| with admin rights to
107 107 the specified repository.
108 108
109 109 This command takes the following options:
110 110
111 111 :param apiuser: filled automatically from apikey
112 112 :type apiuser: AuthUser
113 113 :param usergroupid:
114 114 :type usergroupid: int
115 115
116 116 Example output:
117 117
118 118 .. code-block:: bash
119 119
120 120 id : <id_given_in_input>
121 121 result : {
122 122 "msg": "deleted user group ID:<user_group_id> <user_group_name>"
123 123 }
124 124 error : null
125 125
126 126 Example error output:
127 127
128 128 .. code-block:: bash
129 129
130 130 id : <id_given_in_input>
131 131 result : null
132 132 error : {
133 133 "failed to delete user group ID:<user_group_id> <user_group_name>"
134 134 or
135 135 "RepoGroup assigned to <repo_groups_list>"
136 136 }
137 137
138 138
139 139 get_user_group
140 140 --------------
141 141
142 142 .. py:function:: get_user_group(apiuser, usergroupid)
143 143
144 144 Returns the data of an existing user group.
145 145
146 146 This command can only be run using an |authtoken| with admin rights to
147 147 the specified repository.
148 148
149 149 :param apiuser: This is filled automatically from the |authtoken|.
150 150 :type apiuser: AuthUser
151 151 :param usergroupid: Set the user group from which to return data.
152 152 :type usergroupid: str or int
153 153
154 154 Example error output:
155 155
156 156 .. code-block:: bash
157 157
158 158 {
159 159 "error": null,
160 160 "id": <id>,
161 161 "result": {
162 162 "active": true,
163 163 "group_description": "group description",
164 164 "group_name": "group name",
165 "members": [
165 "permissions": [
166 166 {
167 167 "name": "owner-name",
168 168 "origin": "owner",
169 169 "permission": "usergroup.admin",
170 170 "type": "user"
171 171 },
172 172 {
173 173 {
174 174 "name": "user name",
175 175 "origin": "permission",
176 176 "permission": "usergroup.admin",
177 177 "type": "user"
178 178 },
179 179 {
180 180 "name": "user group name",
181 181 "origin": "permission",
182 182 "permission": "usergroup.write",
183 183 "type": "user_group"
184 184 }
185 185 ],
186 "permissions_summary": {
187 "repositories": {
188 "aa-root-level-repo-1": "repository.admin"
189 },
190 "repositories_groups": {}
191 },
186 192 "owner": "owner name",
187 193 "users": [],
188 194 "users_group_id": 2
189 195 }
190 196 }
191 197
192 198
193 199 get_user_groups
194 200 ---------------
195 201
196 202 .. py:function:: get_user_groups(apiuser)
197 203
198 204 Lists all the existing user groups within RhodeCode.
199 205
200 206 This command can only be run using an |authtoken| with admin rights to
201 207 the specified repository.
202 208
203 209 This command takes the following options:
204 210
205 211 :param apiuser: This is filled automatically from the |authtoken|.
206 212 :type apiuser: AuthUser
207 213
208 214 Example error output:
209 215
210 216 .. code-block:: bash
211 217
212 218 id : <id_given_in_input>
213 219 result : [<user_group_obj>,...]
214 220 error : null
215 221
216 222
217 223 grant_user_group_permission_to_user_group
218 224 -----------------------------------------
219 225
220 226 .. py:function:: grant_user_group_permission_to_user_group(apiuser, usergroupid, sourceusergroupid, perm)
221 227
222 228 Give one user group permissions to another user group.
223 229
224 230 :param apiuser: This is filled automatically from the |authtoken|.
225 231 :type apiuser: AuthUser
226 232 :param usergroupid: Set the user group on which to edit permissions.
227 233 :type usergroupid: str or int
228 234 :param sourceusergroupid: Set the source user group to which
229 235 access/permissions will be granted.
230 236 :type sourceusergroupid: str or int
231 237 :param perm: (usergroup.(none|read|write|admin))
232 238 :type perm: str
233 239
234 240 Example output:
235 241
236 242 .. code-block:: bash
237 243
238 244 id : <id_given_in_input>
239 245 result : {
240 246 "msg": "Granted perm: `<perm_name>` for user group: `<source_user_group_name>` in user group: `<user_group_name>`",
241 247 "success": true
242 248 }
243 249 error : null
244 250
245 251
246 252 grant_user_permission_to_user_group
247 253 -----------------------------------
248 254
249 255 .. py:function:: grant_user_permission_to_user_group(apiuser, usergroupid, userid, perm)
250 256
251 257 Set permissions for a user in a user group.
252 258
253 259 :param apiuser: This is filled automatically from the |authtoken|.
254 260 :type apiuser: AuthUser
255 261 :param usergroupid: Set the user group to edit permissions on.
256 262 :type usergroupid: str or int
257 263 :param userid: Set the user from whom you wish to set permissions.
258 264 :type userid: str
259 265 :param perm: (usergroup.(none|read|write|admin))
260 266 :type perm: str
261 267
262 268 Example output:
263 269
264 270 .. code-block:: bash
265 271
266 272 id : <id_given_in_input>
267 273 result : {
268 274 "msg": "Granted perm: `<perm_name>` for user: `<username>` in user group: `<user_group_name>`",
269 275 "success": true
270 276 }
271 277 error : null
272 278
273 279
274 280 remove_user_from_user_group
275 281 ---------------------------
276 282
277 283 .. py:function:: remove_user_from_user_group(apiuser, usergroupid, userid)
278 284
279 285 Removes a user from a user group.
280 286
281 287 * If the specified user is not in the group, this command will return
282 288 `false`.
283 289
284 290 This command can only be run using an |authtoken| with admin rights to
285 291 the specified user group.
286 292
287 293 :param apiuser: This is filled automatically from the |authtoken|.
288 294 :type apiuser: AuthUser
289 295 :param usergroupid: Sets the user group name.
290 296 :type usergroupid: str or int
291 297 :param userid: The user you wish to remove from |RCE|.
292 298 :type userid: str or int
293 299
294 300 Example output:
295 301
296 302 .. code-block:: bash
297 303
298 304 id : <id_given_in_input>
299 305 result: {
300 306 "success": True|False, # depends on if member is in group
301 307 "msg": "removed member <username> from user group <groupname> |
302 308 User wasn't in group"
303 309 }
304 310 error: null
305 311
306 312
307 313 revoke_user_group_permission_from_user_group
308 314 --------------------------------------------
309 315
310 316 .. py:function:: revoke_user_group_permission_from_user_group(apiuser, usergroupid, sourceusergroupid)
311 317
312 318 Revoke the permissions that one user group has to another.
313 319
314 320 :param apiuser: This is filled automatically from the |authtoken|.
315 321 :type apiuser: AuthUser
316 322 :param usergroupid: Set the user group on which to edit permissions.
317 323 :type usergroupid: str or int
318 324 :param sourceusergroupid: Set the user group from which permissions
319 325 are revoked.
320 326 :type sourceusergroupid: str or int
321 327
322 328 Example output:
323 329
324 330 .. code-block:: bash
325 331
326 332 id : <id_given_in_input>
327 333 result : {
328 334 "msg": "Revoked perm for user group: `<user_group_name>` in user group: `<target_user_group_name>`",
329 335 "success": true
330 336 }
331 337 error : null
332 338
333 339
334 340 revoke_user_permission_from_user_group
335 341 --------------------------------------
336 342
337 343 .. py:function:: revoke_user_permission_from_user_group(apiuser, usergroupid, userid)
338 344
339 345 Revoke a users permissions in a user group.
340 346
341 347 :param apiuser: This is filled automatically from the |authtoken|.
342 348 :type apiuser: AuthUser
343 349 :param usergroupid: Set the user group from which to revoke the user
344 350 permissions.
345 351 :type: usergroupid: str or int
346 352 :param userid: Set the userid of the user whose permissions will be
347 353 revoked.
348 354 :type userid: str
349 355
350 356 Example output:
351 357
352 358 .. code-block:: bash
353 359
354 360 id : <id_given_in_input>
355 361 result : {
356 362 "msg": "Revoked perm for user: `<username>` in user group: `<user_group_name>`",
357 363 "success": true
358 364 }
359 365 error : null
360 366
361 367
362 368 update_user_group
363 369 -----------------
364 370
365 371 .. py:function:: update_user_group(apiuser, usergroupid, group_name=<Optional:''>, description=<Optional:''>, owner=<Optional:None>, active=<Optional:True>)
366 372
367 373 Updates the specified `user group` with the details provided.
368 374
369 375 This command can only be run using an |authtoken| with admin rights to
370 376 the specified repository.
371 377
372 378 :param apiuser: This is filled automatically from the |authtoken|.
373 379 :type apiuser: AuthUser
374 380 :param usergroupid: Set the id of the `user group` to update.
375 381 :type usergroupid: str or int
376 382 :param group_name: Set the new name the `user group`
377 383 :type group_name: str
378 384 :param description: Give a description for the `user group`
379 385 :type description: str
380 386 :param owner: Set the owner of the `user group`.
381 387 :type owner: Optional(str or int)
382 388 :param active: Set the group as active.
383 389 :type active: Optional(``True`` | ``False``)
384 390
385 391 Example output:
386 392
387 393 .. code-block:: bash
388 394
389 395 id : <id_given_in_input>
390 396 result : {
391 397 "msg": 'updated user group ID:<user group id> <user group name>',
392 398 "user_group": <user_group_object>
393 399 }
394 400 error : null
395 401
396 402 Example error output:
397 403
398 404 .. code-block:: bash
399 405
400 406 id : <id_given_in_input>
401 407 result : null
402 408 error : {
403 409 "failed to update user group `<user group name>`"
404 410 }
405 411
406 412
@@ -1,325 +1,326 b''
1 1 .. _user-methods-ref:
2 2
3 3 user methods
4 4 ============
5 5
6 6 create_user
7 7 -----------
8 8
9 9 .. py:function:: create_user(apiuser, username, email, password=<Optional:''>, firstname=<Optional:''>, lastname=<Optional:''>, active=<Optional:True>, admin=<Optional:False>, extern_name=<Optional:'rhodecode'>, extern_type=<Optional:'rhodecode'>, force_password_change=<Optional:False>, create_personal_repo_group=<Optional:None>)
10 10
11 11 Creates a new user and returns the new user object.
12 12
13 13 This command can only be run using an |authtoken| with admin rights to
14 14 the specified repository.
15 15
16 16 This command takes the following options:
17 17
18 18 :param apiuser: This is filled automatically from the |authtoken|.
19 19 :type apiuser: AuthUser
20 20 :param username: Set the new username.
21 21 :type username: str or int
22 22 :param email: Set the user email address.
23 23 :type email: str
24 24 :param password: Set the new user password.
25 25 :type password: Optional(str)
26 26 :param firstname: Set the new user firstname.
27 27 :type firstname: Optional(str)
28 28 :param lastname: Set the new user surname.
29 29 :type lastname: Optional(str)
30 30 :param active: Set the user as active.
31 31 :type active: Optional(``True`` | ``False``)
32 32 :param admin: Give the new user admin rights.
33 33 :type admin: Optional(``True`` | ``False``)
34 34 :param extern_name: Set the authentication plugin name.
35 35 Using LDAP this is filled with LDAP UID.
36 36 :type extern_name: Optional(str)
37 37 :param extern_type: Set the new user authentication plugin.
38 38 :type extern_type: Optional(str)
39 39 :param force_password_change: Force the new user to change password
40 40 on next login.
41 41 :type force_password_change: Optional(``True`` | ``False``)
42 42 :param create_personal_repo_group: Create personal repo group for this user
43 43 :type create_personal_repo_group: Optional(``True`` | ``False``)
44 44
45 45 Example output:
46 46
47 47 .. code-block:: bash
48 48
49 49 id : <id_given_in_input>
50 50 result: {
51 51 "msg" : "created new user `<username>`",
52 52 "user": <user_obj>
53 53 }
54 54 error: null
55 55
56 56 Example error output:
57 57
58 58 .. code-block:: bash
59 59
60 60 id : <id_given_in_input>
61 61 result : null
62 62 error : {
63 63 "user `<username>` already exist"
64 64 or
65 65 "email `<email>` already exist"
66 66 or
67 67 "failed to create user `<username>`"
68 68 }
69 69
70 70
71 71 delete_user
72 72 -----------
73 73
74 74 .. py:function:: delete_user(apiuser, userid)
75 75
76 76 Deletes the specified user from the |RCE| user database.
77 77
78 78 This command can only be run using an |authtoken| with admin rights to
79 79 the specified repository.
80 80
81 81 .. important::
82 82
83 83 Ensure all open pull requests and open code review
84 84 requests to this user are close.
85 85
86 86 Also ensure all repositories, or repository groups owned by this
87 87 user are reassigned before deletion.
88 88
89 89 This command takes the following options:
90 90
91 91 :param apiuser: This is filled automatically from the |authtoken|.
92 92 :type apiuser: AuthUser
93 93 :param userid: Set the user to delete.
94 94 :type userid: str or int
95 95
96 96 Example output:
97 97
98 98 .. code-block:: bash
99 99
100 100 id : <id_given_in_input>
101 101 result: {
102 102 "msg" : "deleted user ID:<userid> <username>",
103 103 "user": null
104 104 }
105 105 error: null
106 106
107 107 Example error output:
108 108
109 109 .. code-block:: bash
110 110
111 111 id : <id_given_in_input>
112 112 result : null
113 113 error : {
114 114 "failed to delete user ID:<userid> <username>"
115 115 }
116 116
117 117
118 118 get_user
119 119 --------
120 120
121 121 .. py:function:: get_user(apiuser, userid=<Optional:<OptionalAttr:apiuser>>)
122 122
123 123 Returns the information associated with a username or userid.
124 124
125 125 * If the ``userid`` is not set, this command returns the information
126 126 for the ``userid`` calling the method.
127 127
128 128 .. note::
129 129
130 130 Normal users may only run this command against their ``userid``. For
131 131 full privileges you must run this command using an |authtoken| with
132 132 admin rights.
133 133
134 134 :param apiuser: This is filled automatically from the |authtoken|.
135 135 :type apiuser: AuthUser
136 136 :param userid: Sets the userid for which data will be returned.
137 137 :type userid: Optional(str or int)
138 138
139 139 Example output:
140 140
141 141 .. code-block:: bash
142 142
143 143 {
144 144 "error": null,
145 145 "id": <id>,
146 146 "result": {
147 147 "active": true,
148 148 "admin": false,
149 149 "api_keys": [ list of keys ],
150 150 "auth_tokens": [ list of tokens with details ],
151 151 "email": "user@example.com",
152 152 "emails": [
153 153 "user@example.com"
154 154 ],
155 155 "extern_name": "rhodecode",
156 156 "extern_type": "rhodecode",
157 157 "firstname": "username",
158 158 "ip_addresses": [],
159 159 "language": null,
160 160 "last_login": "Timestamp",
161 161 "last_activity": "Timestamp",
162 162 "lastname": "surnae",
163 "permissions": {
163 "permissions": <deprecated>,
164 "permissions_summary": {
164 165 "global": [
165 166 "hg.inherit_default_perms.true",
166 167 "usergroup.read",
167 168 "hg.repogroup.create.false",
168 169 "hg.create.none",
169 170 "hg.password_reset.enabled",
170 171 "hg.extern_activate.manual",
171 172 "hg.create.write_on_repogroup.false",
172 173 "hg.usergroup.create.false",
173 174 "group.none",
174 175 "repository.none",
175 176 "hg.register.none",
176 177 "hg.fork.repository"
177 178 ],
178 179 "repositories": { "username/example": "repository.write"},
179 180 "repositories_groups": { "user-group/repo": "group.none" },
180 181 "user_groups": { "user_group_name": "usergroup.read" }
181 },
182 }
182 183 "user_id": 32,
183 184 "username": "username"
184 185 }
185 186 }
186 187
187 188
188 189 get_user_audit_logs
189 190 -------------------
190 191
191 192 .. py:function:: get_user_audit_logs(apiuser, userid=<Optional:<OptionalAttr:apiuser>>)
192 193
193 194 Fetches all action logs made by the specified user.
194 195
195 196 This command takes the following options:
196 197
197 198 :param apiuser: This is filled automatically from the |authtoken|.
198 199 :type apiuser: AuthUser
199 200 :param userid: Sets the userid whose list of locked |repos| will be
200 201 displayed.
201 202 :type userid: Optional(str or int)
202 203
203 204 Example output:
204 205
205 206 .. code-block:: bash
206 207
207 208 id : <id_given_in_input>
208 209 result : {
209 210 [action, action,...]
210 211 }
211 212 error : null
212 213
213 214
214 215 get_user_locks
215 216 --------------
216 217
217 218 .. py:function:: get_user_locks(apiuser, userid=<Optional:<OptionalAttr:apiuser>>)
218 219
219 220 Displays all repositories locked by the specified user.
220 221
221 222 * If this command is run by a non-admin user, it returns
222 223 a list of |repos| locked by that user.
223 224
224 225 This command takes the following options:
225 226
226 227 :param apiuser: This is filled automatically from the |authtoken|.
227 228 :type apiuser: AuthUser
228 229 :param userid: Sets the userid whose list of locked |repos| will be
229 230 displayed.
230 231 :type userid: Optional(str or int)
231 232
232 233 Example output:
233 234
234 235 .. code-block:: bash
235 236
236 237 id : <id_given_in_input>
237 238 result : {
238 239 [repo_object, repo_object,...]
239 240 }
240 241 error : null
241 242
242 243
243 244 get_users
244 245 ---------
245 246
246 247 .. py:function:: get_users(apiuser)
247 248
248 249 Lists all users in the |RCE| user database.
249 250
250 251 This command can only be run using an |authtoken| with admin rights to
251 252 the specified repository.
252 253
253 254 This command takes the following options:
254 255
255 256 :param apiuser: This is filled automatically from the |authtoken|.
256 257 :type apiuser: AuthUser
257 258
258 259 Example output:
259 260
260 261 .. code-block:: bash
261 262
262 263 id : <id_given_in_input>
263 264 result: [<user_object>, ...]
264 265 error: null
265 266
266 267
267 268 update_user
268 269 -----------
269 270
270 271 .. py:function:: update_user(apiuser, userid, username=<Optional:None>, email=<Optional:None>, password=<Optional:None>, firstname=<Optional:None>, lastname=<Optional:None>, active=<Optional:None>, admin=<Optional:None>, extern_type=<Optional:None>, extern_name=<Optional:None>)
271 272
272 273 Updates the details for the specified user, if that user exists.
273 274
274 275 This command can only be run using an |authtoken| with admin rights to
275 276 the specified repository.
276 277
277 278 This command takes the following options:
278 279
279 280 :param apiuser: This is filled automatically from |authtoken|.
280 281 :type apiuser: AuthUser
281 282 :param userid: Set the ``userid`` to update.
282 283 :type userid: str or int
283 284 :param username: Set the new username.
284 285 :type username: str or int
285 286 :param email: Set the new email.
286 287 :type email: str
287 288 :param password: Set the new password.
288 289 :type password: Optional(str)
289 290 :param firstname: Set the new first name.
290 291 :type firstname: Optional(str)
291 292 :param lastname: Set the new surname.
292 293 :type lastname: Optional(str)
293 294 :param active: Set the new user as active.
294 295 :type active: Optional(``True`` | ``False``)
295 296 :param admin: Give the user admin rights.
296 297 :type admin: Optional(``True`` | ``False``)
297 298 :param extern_name: Set the authentication plugin user name.
298 299 Using LDAP this is filled with LDAP UID.
299 300 :type extern_name: Optional(str)
300 301 :param extern_type: Set the authentication plugin type.
301 302 :type extern_type: Optional(str)
302 303
303 304
304 305 Example output:
305 306
306 307 .. code-block:: bash
307 308
308 309 id : <id_given_in_input>
309 310 result: {
310 311 "msg" : "updated user ID:<userid> <username>",
311 312 "user": <user_object>,
312 313 }
313 314 error: null
314 315
315 316 Example error output:
316 317
317 318 .. code-block:: bash
318 319
319 320 id : <id_given_in_input>
320 321 result : null
321 322 error : {
322 323 "failed to update user `<username>`"
323 324 }
324 325
325 326
General Comments 0
You need to be logged in to leave comments. Login now