1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 19:05:16 +00:00

change online-read-write permission UI (#5560)

* change online-read-write permission UI

* update

* update
This commit is contained in:
lian 2023-08-01 15:27:19 +08:00 committed by GitHub
parent 18c7b34046
commit 4fa64236ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 14 deletions

View File

@ -621,7 +621,7 @@ class DirentListItem extends React.Component {
{showShareBtn && (
<a href="#" className="op-icon sf2-icon-share" title={gettext('Share')} role="button" aria-label={gettext('Share')} onClick={this.onItemShare}></a>
)}
{(dirent.permission === 'rw' || (isCustomPermission && canDelete)) && (
{(dirent.permission === 'rw' || dirent.permission === 'cloud-edit' || (isCustomPermission && canDelete)) && (
<a href="#" className="op-icon sf2-icon-delete" title={gettext('Delete')} role="button" aria-label={gettext('Delete')} onClick={this.onItemDelete}></a>
)}
<ItemDropdownMenu
@ -645,7 +645,7 @@ class DirentListItem extends React.Component {
{showShareBtn && (
<a href="#" className="op-icon sf2-icon-share" title={gettext('Share')} role="button" aria-label={gettext('Share')} onClick={this.onItemShare}></a>
)}
{(dirent.permission === 'rw' || (isCustomPermission && canDelete)) && (
{(dirent.permission === 'rw' || dirent.permission === 'cloud-edit' || (isCustomPermission && canDelete)) && (
<a href="#" className="op-icon sf2-icon-delete" title={gettext('Delete')} role="button" aria-label={gettext('Delete')} onClick={this.onItemDelete}></a>
)}
<ItemDropdownMenu

View File

@ -239,7 +239,7 @@ class DirOperationToolbar extends React.Component {
return (
<Fragment>
{(userPerm === 'rw' || userPerm === 'admin' || isCustomPermission) && (
{(userPerm === 'rw' || userPerm === 'admin' || userPerm === 'cloud-edit' || isCustomPermission) && (
<div className="dir-operation">
{content}
</div>

View File

@ -358,6 +358,13 @@ class MultipleDirOperationToolbar extends React.Component {
{canDownload && <Button className="secondary group-op-item action-icon sf2-icon-download" title={gettext('Download')} aria-label={gettext('Download')} onClick={this.onItemsDownload}></Button>}
</Fragment>
)}
{userPerm === 'cloud-edit' && (
<Fragment>
{canModify && <Button className="secondary group-op-item action-icon sf2-icon-move" title={gettext('Move')} aria-label={gettext('Move')} onClick={this.onMoveToggle}></Button>}
{canCopy && <Button className="secondary group-op-item action-icon sf2-icon-copy" title={gettext('Copy')} aria-label={gettext('Copy')} onClick={this.onCopyToggle}></Button>}
{canDelete && <Button className="secondary group-op-item action-icon sf2-icon-delete" title={gettext('Delete')} aria-label={gettext('Delete')} onClick={this.onItemsDelete}></Button>}
</Fragment>
)}
{userPerm === 'r' && (
<Fragment>
<Button className="secondary group-op-item action-icon sf2-icon-copy" title={gettext('Copy')} aria-label={gettext('Copy')} onClick={this.onCopyToggle}></Button>

View File

@ -480,7 +480,7 @@ export const Utils = {
list.push(SHARE);
}
if (permission == 'rw') {
if (permission == 'rw' || permission == 'cloud-edit') {
list.push(DELETE, 'Divider');
}
@ -489,7 +489,7 @@ export const Utils = {
}
}
if (permission == 'rw') {
if (permission == 'rw' || permission == 'cloud-edit') {
list.push(RENAME, MOVE);
}
@ -497,7 +497,7 @@ export const Utils = {
list.push(RENAME, MOVE);
}
if (permission == 'rw') {
if (permission == 'rw' || permission == 'cloud-edit') {
list.push(COPY);
}
@ -544,7 +544,7 @@ export const Utils = {
list.push(SHARE);
}
if (permission == 'rw') {
if (permission == 'rw' || permission == 'cloud-edit') {
if (!dirent.is_locked || (dirent.is_locked && dirent.locked_by_me)) {
list.push(DELETE);
}
@ -559,7 +559,7 @@ export const Utils = {
}
}
if (permission == 'rw') {
if (permission == 'rw' || permission == 'cloud-edit') {
if (!dirent.is_locked || (dirent.is_locked && dirent.locked_by_me)) {
list.push(RENAME, MOVE);
}
@ -571,7 +571,7 @@ export const Utils = {
}
}
if (permission == 'rw') {
if (permission == 'rw' || permission == 'cloud-edit') {
list.push(COPY);
}

View File

@ -1564,7 +1564,7 @@ class ReposBatchDeleteItemView(APIView):
folder_permission_dict = get_sub_folder_permission_by_dir(request, repo_id, parent_dir)
for dirent in dirents:
if dirent in list(folder_permission_dict.keys()) and \
folder_permission_dict[dirent] != 'rw':
folder_permission_dict[dirent] not in ('rw', 'cloud-edit'):
error_msg = _("Can't delete folder %s, please check its permission.") % dirent
return api_error(status.HTTP_403_FORBIDDEN, error_msg)

View File

@ -79,15 +79,15 @@ def parse_repo_perm(perm):
RP.can_download = True if perm in [
PERMISSION_READ, PERMISSION_READ_WRITE, PERMISSION_ADMIN] else False
RP.can_upload = True if perm in [
PERMISSION_READ_WRITE, PERMISSION_ADMIN] else False
PERMISSION_READ_WRITE, PERMISSION_ADMIN, PERMISSION_PREVIEW_EDIT] else False
RP.can_edit_on_web = True if perm in [
PERMISSION_READ_WRITE, PERMISSION_ADMIN, PERMISSION_PREVIEW_EDIT
] else False
RP.can_copy = True if perm in [
PERMISSION_READ, PERMISSION_READ_WRITE, PERMISSION_ADMIN,
PERMISSION_READ, PERMISSION_READ_WRITE, PERMISSION_ADMIN, PERMISSION_PREVIEW_EDIT
] else False
RP.can_delete = True if perm in [
PERMISSION_READ_WRITE, PERMISSION_ADMIN,
PERMISSION_READ_WRITE, PERMISSION_ADMIN, PERMISSION_PREVIEW_EDIT
] else False
RP.can_preview = True if perm in [
PERMISSION_READ, PERMISSION_READ_WRITE, PERMISSION_ADMIN,

View File

@ -59,7 +59,7 @@ class TestParseRepoPerm(BaseTestCase):
assert parse_repo_perm(PERMISSION_READ_WRITE).can_upload is True
assert parse_repo_perm(PERMISSION_READ).can_upload is False
assert parse_repo_perm(PERMISSION_PREVIEW).can_upload is False
assert parse_repo_perm(PERMISSION_PREVIEW_EDIT).can_upload is False
assert parse_repo_perm(PERMISSION_PREVIEW_EDIT).can_upload is True
def test_valid_prop(self):
assert parse_repo_perm(PERMISSION_READ).can_download is True