mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 01:12:03 +00:00
custom share permission (#4967)
* custom share permission * remove path field * add permission manager ui * optimize custom permission manager style * add permission setting * add normalize_custom_permission_name * optimize repo custom permission * delete useless code * optimize code * optimize code * optimize markdown file page * fix a few bugs * add permission control * repair modify permission * optimize style * optimize copyright * add try-except * optimize code * move file&folder * batch operation item * repair batch move item * update copyright * optimize move permission control * optimize code * optimize code * optimize code & fix code wranning * optimize code * delete unsupport permission * optimize code * repair code bug * add pro limit * optimize code * add permission handle for permission editor * repair new file&folder bug * optimize file uploader code * custom permission user can not visit custom permission module * optimize code * forbid comment&detail module * optimize code * optimize modify/preview permission * optimize custom permission share perm * optimize view file module: file-toolbar * optimize custom drag move operation * repair column view bug * optimize drag operation code * repair code bug * optimize code Co-authored-by: shanshuirenjia <978987373@qq.com>
This commit is contained in:
@@ -339,26 +339,39 @@ class MultipleDirOperationToolbar extends React.Component {
|
||||
|
||||
const { repoID, userPerm } = this.props;
|
||||
const dirent = this.props.selectedDirentList[0];
|
||||
const direntPath = this.getDirentPath(dirent);
|
||||
|
||||
let direntPath = this.getDirentPath(dirent);
|
||||
const { isCustomPermission, customPermission } = Utils.getUserPermission(userPerm);
|
||||
let canDelete = true;
|
||||
let canDownload = true;
|
||||
let canCopy = true;
|
||||
let canModify = true;
|
||||
if (isCustomPermission) {
|
||||
const { permission } = customPermission;
|
||||
canDelete = permission.delete;
|
||||
canDownload = permission.download;
|
||||
canCopy = permission.copy;
|
||||
canModify = permission.modify;
|
||||
}
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<div className="dir-operation">
|
||||
<div className="d-flex">
|
||||
<ButtonGroup className="flex-row group-operations">
|
||||
{(userPerm === 'rw' || userPerm === 'admin') && (
|
||||
{(userPerm === 'rw' || userPerm === 'admin' || isCustomPermission) && (
|
||||
<Fragment>
|
||||
<Button className="secondary group-op-item action-icon sf2-icon-move" title={gettext('Move')} onClick={this.onMoveToggle}></Button>
|
||||
<Button className="secondary group-op-item action-icon sf2-icon-copy" title={gettext('Copy')} onClick={this.onCopyToggle}></Button>
|
||||
<Button className="secondary group-op-item action-icon sf2-icon-delete" title={gettext('Delete')} onClick={this.onItemsDelete}></Button>
|
||||
{canModify && <Button className="secondary group-op-item action-icon sf2-icon-move" title={gettext('Move')} onClick={this.onMoveToggle}></Button>}
|
||||
{canCopy && <Button className="secondary group-op-item action-icon sf2-icon-copy" title={gettext('Copy')} onClick={this.onCopyToggle}></Button>}
|
||||
{canDelete && <Button className="secondary group-op-item action-icon sf2-icon-delete" title={gettext('Delete')} onClick={this.onItemsDelete}></Button>}
|
||||
{canDownload && <Button className="secondary group-op-item action-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemsDownload}></Button>}
|
||||
</Fragment>
|
||||
)}
|
||||
{userPerm === 'r' && (
|
||||
<Button className="secondary group-op-item action-icon sf2-icon-copy" title={gettext('Copy')} onClick={this.onCopyToggle}></Button>
|
||||
)}
|
||||
{(userPerm === 'rw' || userPerm === 'admin' || userPerm === 'r') && (
|
||||
<Button className="secondary group-op-item action-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemsDownload}></Button>
|
||||
<Fragment>
|
||||
<Button className="secondary group-op-item action-icon sf2-icon-copy" title={gettext('Copy')} onClick={this.onCopyToggle}></Button>
|
||||
<Button className="secondary group-op-item action-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemsDownload}></Button>
|
||||
</Fragment>
|
||||
)}
|
||||
{this.props.selectedDirentList.length === 1 &&
|
||||
<ItemDropdownMenu
|
||||
@@ -372,7 +385,7 @@ class MultipleDirOperationToolbar extends React.Component {
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
</div>
|
||||
{Utils.isDesktop() && <ViewModeToolbar currentMode={this.props.currentMode} switchViewMode={this.props.switchViewMode} />}
|
||||
{Utils.isDesktop() && <ViewModeToolbar currentMode={this.props.currentMode} switchViewMode={this.props.switchViewMode} isCustomPermission={isCustomPermission} />}
|
||||
{this.state.isMoveDialogShow &&
|
||||
<MoveDirentDialog
|
||||
path={this.props.path}
|
||||
|
Reference in New Issue
Block a user