mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 16:31:13 +00:00
Add preview related share perms
Squashed commit of the following: commit 12f52311df704e48c282b2a47f59f7a283cfa5c5 Author: zhengxie <xiez1989@gmail.com> Date: Tue Sep 11 15:14:34 2018 +0800 [API] Update client sync and list dir items apis commit bc18d19dc0f648732c5933c6918d8e784fc0f910 Author: llj <lingjun.li1@gmail.com> Date: Tue Sep 4 12:22:10 2018 +0800 Add preview related share perms Squashed commit of the following: commit 658bdbdc7acf262f2c0abb0387cf3142b2d8ee37 Author: llj <lingjun.li1@gmail.com> Date: Tue Sep 4 12:17:47 2018 +0800 [library icon title] added title for 'admin' permission commit 51a088fd7987e2307e5666facb6627d42a7843ec Author: zhengxie <xiez1989@gmail.com> Date: Sat Sep 1 15:33:09 2018 +0800 Add preview related share perms Squashed commit of the following: commit 42fe21ef0ba3bad4fb68dc5283194cb34eb7775a Author: llj <lingjun.li1@gmail.com> Date: Sat Sep 1 13:33:59 2018 +0800 [icon tip] modified library/folder icon title commit 077fecdce80bce966296a1735896a24bf32c282f Author: zhengxie <xiez1989@gmail.com> Date: Mon Aug 27 11:05:34 2018 +0800 Add preview related share perms Squashed commit of the following: commit 5783325eb25d7298ea3db7f59595446d122889e5 Author: llj <lingjun.li1@gmail.com> Date: Fri Aug 24 21:14:59 2018 +0800 fixup commit 5f4f4025221f4026a4e7a9bc1c7bba5d6decf5a9 Author: zhengxie <xiez1989@gmail.com> Date: Fri Aug 24 20:55:41 2018 +0800 Fix wopi perm commit 632744cd5e56f8812af0efe523cf5751bbf57b66 Author: zhengxie <xiez1989@gmail.com> Date: Fri Aug 24 17:29:31 2018 +0800 Add preview related share perms Squashed commit of the following: commit 683296449601960d76a2d0245dab694ab16f67b2 Author: llj <lingjun.li1@gmail.com> Date: Fri Aug 24 15:54:59 2018 +0800 modification after adding 2 new permissions commit 3eff1ec06fc7566942b736261a1d5b613d706117 Author: llj <lingjun.li1@gmail.com> Date: Thu Aug 23 14:58:33 2018 +0800 [permission] added 2 new permissions for 'share' & 'folder permission' commit 73a0bfc6560860ac11e96a675fe789a984a194c8 Author: zhengxie <xiez1989@gmail.com> Date: Fri Aug 24 16:34:47 2018 +0800 Add prevew related perms in history file view and text_diff commit 533b3ff0ca4aa5564ecc87456772b70eedfa816f Author: zhengxie <xiez1989@gmail.com> Date: Fri Aug 24 13:49:28 2018 +0800 Add prevew related perms on file views commit 03db78a841baddf6c042988358d20417f06be4ae Author: zhengxie <xiez1989@gmail.com> Date: Thu Aug 23 10:56:17 2018 +0800 [api2] Update repo perms and add is pro version check commit c025319fe56658da3a3dc077743ee016ac5acd4d Author: ilearnit <helloworld.c@outlook.com> Date: Wed Aug 22 11:09:27 2018 +0800 update perm copy/download/share commit ea19ab4c695c99c0c2817616f2177bebae0777a2 Author: zhengxie <xiez1989@gmail.com> Date: Mon Aug 20 16:00:11 2018 +0800 wip: add repo preview related perms. Updated APIs: 1. [api2] group libraries 2. [api2] dir shared items 3. [api2] share link zip tasks Updated Views: 1. wiki & wopi 2. ajax copy/download files/dirs
This commit is contained in:
@@ -8,6 +8,7 @@ from seaserv import seafile_api
|
||||
|
||||
from tests.common.utils import randstring
|
||||
|
||||
from seahub.constants import PERMISSION_PREVIEW, PERMISSION_PREVIEW_EDIT
|
||||
from seahub.test_utils import BaseTestCase, TRAVIS
|
||||
|
||||
|
||||
@@ -243,6 +244,24 @@ class DirSharedItemsTest(BaseTestCase):
|
||||
json_resp = json.loads(resp.content)
|
||||
assert 'has been shared to' in json_resp['failed'][0]['error_msg']
|
||||
|
||||
def test_can_share_repo_to_groups_with_perms(self):
|
||||
self.login_as(self.user)
|
||||
|
||||
grp1 = self.group
|
||||
grp2 = self.create_group(group_name="test-grp2",
|
||||
username=self.user.username)
|
||||
|
||||
for g, perm in [(grp1, PERMISSION_PREVIEW), (grp2, PERMISSION_PREVIEW_EDIT)]:
|
||||
resp = self.client.put(
|
||||
'/api2/repos/%s/dir/shared_items/?p=/' % (self.repo.id),
|
||||
"share_type=group&&group_id=%d&permission=%s" % (g.id, perm),
|
||||
'application/x-www-form-urlencoded',
|
||||
)
|
||||
self.assertEqual(200, resp.status_code)
|
||||
json_resp = json.loads(resp.content)
|
||||
assert len(json_resp['success']) == 1
|
||||
assert json_resp['success'][0]['permission'] == perm
|
||||
|
||||
@pytest.mark.skipif(TRAVIS, reason="") # pylint: disable=E1101
|
||||
def test_can_share_repo_to_org_groups(self):
|
||||
self.login_as(self.org_user)
|
||||
|
Reference in New Issue
Block a user