atlassian-python-api 4.0.1__py3-none-any.whl → 4.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
atlassian/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.1
1
+ 4.0.2
atlassian/confluence.py CHANGED
@@ -2425,7 +2425,7 @@ class Confluence(AtlassianRestAPI):
2425
2425
  else:
2426
2426
  members.extend(values)
2427
2427
  if not members:
2428
- print((f"Did not get members from {group_name} group, please check permissions or connectivity"))
2428
+ print(f"Did not get members from {group_name} group, please check permissions or connectivity")
2429
2429
  return members
2430
2430
 
2431
2431
  def get_space(self, space_key, expand="description.plain,homepage", params=None):
@@ -3315,6 +3315,250 @@ class Confluence(AtlassianRestAPI):
3315
3315
  url = "rest/api/user/%s/group/%s" % (username, group_name)
3316
3316
  return self.put(url)
3317
3317
 
3318
+ # Space Permissions
3319
+ def get_all_space_permissions(self, space_key):
3320
+ """
3321
+ Returns list of permissions granted to users and groups in the particular space.
3322
+ :param space_key:
3323
+ :return:
3324
+ """
3325
+ url = f"rest/api/space/{space_key}/permissions"
3326
+ return self.get(url)
3327
+
3328
+ def set_permissions_to_multiple_items_for_space(self, space_key, user_key=None, group_name=None, operations=None):
3329
+ """
3330
+ Sets permissions to multiple users/groups in the given space.
3331
+ Request should contain all permissions that user/group/anonymous user will have in a given space.
3332
+ If permission is absent in the request, but was granted before, it will be revoked.
3333
+ If empty list of permissions passed to user/group/anonymous user,
3334
+ then all their existing permissions will be revoked.
3335
+ If user/group/anonymous user not mentioned in the request, their permissions will not be revoked.
3336
+
3337
+ Maximum 40 different users/groups/anonymous user could be passed in the request.
3338
+ :param space_key:
3339
+ :param user_key:
3340
+ :param group_name:
3341
+ :param operations:
3342
+ :return:
3343
+ """
3344
+ url = f"rest/api/space/{space_key}/permissions"
3345
+ params = []
3346
+
3347
+ if user_key:
3348
+ params.append({"userKey": user_key, "operations": operations or []})
3349
+
3350
+ if group_name:
3351
+ params.append({"groupName": group_name, "operations": operations or []})
3352
+
3353
+ if not user_key and not group_name:
3354
+ params.append({"operations": operations or []})
3355
+ payload_json = json.dumps(params)
3356
+ return self.post(url, data=payload_json)
3357
+
3358
+ def get_permissions_granted_to_anonymous_for_space(self, space_key):
3359
+ """
3360
+ Get permissions granted to anonymous user for the given space
3361
+ :param space_key:
3362
+ :return:
3363
+ """
3364
+ url = f"rest/api/space/{space_key}/permissions/anonymous"
3365
+ return self.get(url)
3366
+
3367
+ def set_permissions_to_anonymous_for_space(self, space_key, operations=None):
3368
+ """
3369
+ Grant permissions to anonymous user in the given space. Operation doesn't override existing permissions,
3370
+ will only add those one that weren't granted before. Multiple permissions could be passed in one request.
3371
+ Supported targetType and operationKey pairs:
3372
+
3373
+ space read
3374
+ space administer
3375
+ space export
3376
+ space restrict
3377
+ space delete_own
3378
+ space delete_mail
3379
+ page create
3380
+ page delete
3381
+ blogpost create
3382
+ blogpost delete
3383
+ comment create
3384
+ comment delete
3385
+ attachment create
3386
+ attachment delete
3387
+ :param space_key:
3388
+ :param operations:
3389
+ :return:
3390
+ """
3391
+ url = f"rest/api/space/{space_key}/permissions/anonymous"
3392
+ data = {"operations": operations or []}
3393
+ return self.put(url, data=data)
3394
+
3395
+ def remove_permissions_from_anonymous_for_space(self, space_key, operations=None):
3396
+ """
3397
+ Revoke permissions from anonymous user in the given space.
3398
+ If anonymous user doesn't have permissions that we are trying to revoke,
3399
+ those permissions will be silently skipped. Multiple permissions could be passed in one request.
3400
+ Supported targetType and operationKey pairs:
3401
+
3402
+ space read
3403
+ space administer
3404
+ space export
3405
+ space restrict
3406
+ space delete_own
3407
+ space delete_mail
3408
+ page create
3409
+ page delete
3410
+ blogpost create
3411
+ blogpost delete
3412
+ comment create
3413
+ comment delete
3414
+ attachment create
3415
+ attachment delete
3416
+ :param space_key:
3417
+ :param operations:
3418
+ :return:
3419
+ """
3420
+ url = f"rest/api/space/{space_key}/permissions/anonymous/revoke"
3421
+ data = {"operations": operations or []}
3422
+ return self.put(url, data=data)
3423
+
3424
+ def get_permissions_granted_to_group_for_space(self, space_key, group_name):
3425
+ """
3426
+ Get permissions granted to group for the given space
3427
+ :param space_key:
3428
+ :param group_name:
3429
+ :return:
3430
+ """
3431
+ url = f"rest/api/space/{space_key}/permissions/group/{group_name}"
3432
+ return self.get(url)
3433
+
3434
+ def set_permissions_to_group_for_space(self, space_key, group_name, operations=None):
3435
+ """
3436
+ Grant permissions to group in the given space.
3437
+ Operation doesn't override existing permissions, will only add those one that weren't granted before.
3438
+ Multiple permissions could be passed in one request. Supported targetType and operationKey pairs:
3439
+
3440
+ space read
3441
+ space administer
3442
+ space export
3443
+ space restrict
3444
+ space delete_own
3445
+ space delete_mail
3446
+ page create
3447
+ page delete
3448
+ blogpost create
3449
+ blogpost delete
3450
+ comment create
3451
+ comment delete
3452
+ attachment create
3453
+ attachment delete
3454
+ :param space_key:
3455
+ :param group_name:
3456
+ :param operations:
3457
+ :return:
3458
+ """
3459
+ url = f"rest/api/space/{space_key}/permissions/group/{group_name}"
3460
+ data = {"operations": operations or []}
3461
+ return self.put(url, data=data)
3462
+
3463
+ def remove_permissions_from_group_for_space(self, space_key, group_name, operations=None):
3464
+ """
3465
+ Revoke permissions from a group in the given space.
3466
+ If group doesn't have permissions that we are trying to revoke,
3467
+ those permissions will be silently skipped. Multiple permissions could be passed in one request.
3468
+ Supported targetType and operationKey pairs:
3469
+
3470
+ space read
3471
+ space administer
3472
+ space export
3473
+ space restrict
3474
+ space delete_own
3475
+ space delete_mail
3476
+ page create
3477
+ page delete
3478
+ blogpost create
3479
+ blogpost delete
3480
+ comment create
3481
+ comment delete
3482
+ attachment create
3483
+ attachment delete
3484
+ :param space_key:
3485
+ :param group_name:
3486
+ :param operations:
3487
+ :return:
3488
+ """
3489
+ url = f"rest/api/space/{space_key}/permissions/group/{group_name}/revoke"
3490
+ data = {"operations": operations or []}
3491
+ return self.put(url, data=data)
3492
+
3493
+ def get_permissions_granted_to_user_for_space(self, space_key, user_key):
3494
+ """
3495
+ Get permissions granted to user for the given space
3496
+ :param space_key:
3497
+ :param user_key:
3498
+ :return:
3499
+ """
3500
+ url = f"rest/api/space/{space_key}/permissions/user/{user_key}"
3501
+ return self.get(url)
3502
+
3503
+ def set_permissions_to_user_for_space(self, space_key, user_key, operations=None):
3504
+ """
3505
+ Grant permissions to user in the given space.
3506
+ Operation doesn't override existing permissions, will only add those one that weren't granted before.
3507
+ Multiple permissions could be passed in one request. Supported targetType and operationKey pairs:
3508
+
3509
+ space read
3510
+ space administer
3511
+ space export
3512
+ space restrict
3513
+ space delete_own
3514
+ space delete_mail
3515
+ page create
3516
+ page delete
3517
+ blogpost create
3518
+ blogpost delete
3519
+ comment create
3520
+ comment delete
3521
+ attachment create
3522
+ attachment delete
3523
+ :param space_key:
3524
+ :param user_key:
3525
+ :param operations:
3526
+ :return:
3527
+ """
3528
+ url = f"rest/api/space/{space_key}/permissions/user/{user_key}"
3529
+ data = {"operations": operations or []}
3530
+ return self.put(url, data=data)
3531
+
3532
+ def remove_permissions_from_user_for_space(self, space_key, user_key, operations=None):
3533
+ """
3534
+ Revoke permissions from a user in the given space.
3535
+ If user doesn't have permissions that we are trying to revoke,
3536
+ those permissions will be silently skipped. Multiple permissions could be passed in one request.
3537
+ Supported targetType and operationKey pairs:
3538
+
3539
+ space read
3540
+ space administer
3541
+ space export
3542
+ space restrict
3543
+ space delete_own
3544
+ space delete_mail
3545
+ page create
3546
+ page delete
3547
+ blogpost create
3548
+ blogpost delete
3549
+ comment create
3550
+ comment delete
3551
+ attachment create
3552
+ attachment delete
3553
+ :param space_key:
3554
+ :param user_key:
3555
+ :param operations:
3556
+ :return:
3557
+ """
3558
+ url = f"rest/api/space/{space_key}/permissions/user/{user_key}/revoke"
3559
+ data = {"operations": operations or []}
3560
+ return self.put(url, params=data)
3561
+
3318
3562
  def add_space_permissions(
3319
3563
  self,
3320
3564
  space_key,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atlassian-python-api
3
- Version: 4.0.1
3
+ Version: 4.0.2
4
4
  Summary: Python Atlassian REST API Wrapper
5
5
  Home-page: https://github.com/atlassian-api/atlassian-python-api
6
6
  Download-URL: https://github.com/atlassian-api/atlassian-python-api
@@ -46,6 +46,7 @@ Requires-Dist: oauthlib
46
46
  Requires-Dist: requests_oauthlib
47
47
  Requires-Dist: jmespath
48
48
  Requires-Dist: beautifulsoup4
49
+ Requires-Dist: typing-extensions
49
50
  Provides-Extra: kerberos
50
51
  Requires-Dist: requests-kerberos; extra == "kerberos"
51
52
  Dynamic: author
@@ -1,8 +1,8 @@
1
- atlassian/VERSION,sha256=9NpsFPgUIeK1iOscLU6BITKjDVwrQ2bmI5HTUxyQv0k,5
1
+ atlassian/VERSION,sha256=X95warY7CEKqtnrNr35kGRZKr9OQgJk0vMthskfwWP0,5
2
2
  atlassian/__init__.py,sha256=F13CZFoWIj9pDkj83soA7hwwHtvDC6EqFATey9p36PM,768
3
3
  atlassian/bamboo.py,sha256=Zmi7o7ETuTvCW37Fq4Vq0e_elfaXC_oDMcMl-9wO-d8,48017
4
4
  atlassian/cloud_admin.py,sha256=avdj1FdrGaxIRnPt4bXxQB65P8nVxNEpEHzlcH-ugac,961
5
- atlassian/confluence.py,sha256=yCTSvZjRfw2bNgnTWoIsNJ63u11HBrjDzL1KlMlUfe0,132661
5
+ atlassian/confluence.py,sha256=BwtGFXCvIhNT4gQjmWsCUHutr7zT7nrchS2pVI8JX7Y,141150
6
6
  atlassian/crowd.py,sha256=hsLqcmKLm-qWK3xV1pDYCeGcvUIR8k6DJkMlwcDn8QM,9255
7
7
  atlassian/errors.py,sha256=GAKr6W4zPn7ZUMRLHG8-UgAdVnxDzKVZ-jyGXAccALE,398
8
8
  atlassian/insight.py,sha256=fCR9IXmatTp6-l-pOeLFFQGgBeafSzBdkgIHLWkOXEo,23398
@@ -49,8 +49,8 @@ atlassian/bitbucket/server/common/__init__.py,sha256=woZpR3WXAA3A99hZ1UZI_gLPHaA
49
49
  atlassian/bitbucket/server/common/permissions.py,sha256=ve-hWRIrG0zSMo1hp2uTLHGO1PlXorzZlpt7Sc9KhJw,7300
50
50
  atlassian/bitbucket/server/projects/__init__.py,sha256=6G3MZBOTFpwx5x3chg-M8-BbmOnrdRZiZYp2YKJScbw,7668
51
51
  atlassian/bitbucket/server/projects/repos/__init__.py,sha256=RFnZ5APax9VXASYbHbMjW12L2NR4gWbXzS-c-KyExTI,10776
52
- atlassian_python_api-4.0.1.dist-info/licenses/LICENSE,sha256=xamAnoX0zfBamIilAfP3nSIt7dIvnj7oueX14l6uKPY,11335
53
- atlassian_python_api-4.0.1.dist-info/METADATA,sha256=GGnVZG5YGtPHuxnLeY6jUHkhdYMUxUGIKNghorUjkHo,9486
54
- atlassian_python_api-4.0.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
55
- atlassian_python_api-4.0.1.dist-info/top_level.txt,sha256=84-EDv8LNaZx01TCGjBzglwPU1JSRJ7fPSq9uy55Sv0,10
56
- atlassian_python_api-4.0.1.dist-info/RECORD,,
52
+ atlassian_python_api-4.0.2.dist-info/licenses/LICENSE,sha256=xamAnoX0zfBamIilAfP3nSIt7dIvnj7oueX14l6uKPY,11335
53
+ atlassian_python_api-4.0.2.dist-info/METADATA,sha256=hFE8HFuBk4Vppq8zU2Vck-fwrsn2Ds3s_sUxelcwWhM,9519
54
+ atlassian_python_api-4.0.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
55
+ atlassian_python_api-4.0.2.dist-info/top_level.txt,sha256=84-EDv8LNaZx01TCGjBzglwPU1JSRJ7fPSq9uy55Sv0,10
56
+ atlassian_python_api-4.0.2.dist-info/RECORD,,