mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 08:53:14 +00:00
@@ -157,6 +157,12 @@ class CustomPermissionEditor extends React.Component {
|
|||||||
<span>{gettext('Download')}</span>
|
<span>{gettext('Download')}</span>
|
||||||
</Label>
|
</Label>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
<FormGroup check>
|
||||||
|
<Label check>
|
||||||
|
<Input type="checkbox" onChange={this.onChangePermission('create')} checked={permission.create}/>
|
||||||
|
<span>{gettext('Create')}</span>
|
||||||
|
</Label>
|
||||||
|
</FormGroup>
|
||||||
<FormGroup check>
|
<FormGroup check>
|
||||||
<Label check>
|
<Label check>
|
||||||
<Input type="checkbox" onChange={this.onChangePermission('modify')} checked={permission.modify}/>
|
<Input type="checkbox" onChange={this.onChangePermission('modify')} checked={permission.modify}/>
|
||||||
@@ -168,7 +174,7 @@ class CustomPermissionEditor extends React.Component {
|
|||||||
target={'modify-tip'}
|
target={'modify-tip'}
|
||||||
placement='bottom'
|
placement='bottom'
|
||||||
isOpen={this.state.tooltipOpen}>
|
isOpen={this.state.tooltipOpen}>
|
||||||
({gettext('Modify includes modify file, create file and folder, move/rename file and folder')})
|
({gettext('Modify includes modify file, move/rename file and folder')})
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Label>
|
</Label>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
@@ -332,11 +332,11 @@ class DirentListView extends React.Component {
|
|||||||
|
|
||||||
if (this.props.selectedDirentList.length === 0) {
|
if (this.props.selectedDirentList.length === 0) {
|
||||||
let id = 'dirent-container-menu';
|
let id = 'dirent-container-menu';
|
||||||
|
|
||||||
// custom permission judgement
|
// custom permission judgement
|
||||||
if (isCustomPermission) {
|
if (isCustomPermission) {
|
||||||
const { modify } = customPermission.permission;
|
const { create: canCreate } = customPermission.permission;
|
||||||
if (!modify) return;
|
if (!canCreate) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let menuList = [TextTranslation.NEW_FOLDER, TextTranslation.NEW_FILE];
|
let menuList = [TextTranslation.NEW_FOLDER, TextTranslation.NEW_FILE];
|
||||||
|
@@ -168,11 +168,11 @@ class DirOperationToolbar extends React.Component {
|
|||||||
|
|
||||||
const { isCustomPermission, customPermission } = Utils.getUserPermission(userPerm);
|
const { isCustomPermission, customPermission } = Utils.getUserPermission(userPerm);
|
||||||
let canUpload = true;
|
let canUpload = true;
|
||||||
let canModify = true;
|
let canCreate = true;
|
||||||
if (isCustomPermission) {
|
if (isCustomPermission) {
|
||||||
const { permission } = customPermission;
|
const { permission } = customPermission;
|
||||||
canUpload = permission.upload;
|
canUpload = permission.upload;
|
||||||
canModify = permission.modify;
|
canCreate = permission.create;
|
||||||
}
|
}
|
||||||
|
|
||||||
let content = null;
|
let content = null;
|
||||||
@@ -196,7 +196,7 @@ class DirOperationToolbar extends React.Component {
|
|||||||
<button className="btn btn-secondary operation-item" title={gettext('Upload')} onClick={this.onUploadFile}>{gettext('Upload')}</button>}
|
<button className="btn btn-secondary operation-item" title={gettext('Upload')} onClick={this.onUploadFile}>{gettext('Upload')}</button>}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)}
|
)}
|
||||||
{canModify &&
|
{canCreate &&
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<button className="btn btn-secondary operation-item" onClick={this.onCreateClick} aria-haspopup="true" aria-expanded={this.state.isUploadMenuShow} aria-controls="new-menu">{gettext('New')}</button>
|
<button className="btn btn-secondary operation-item" onClick={this.onCreateClick} aria-haspopup="true" aria-expanded={this.state.isUploadMenuShow} aria-controls="new-menu">{gettext('New')}</button>
|
||||||
{this.state.isCreateMenuShow && (
|
{this.state.isCreateMenuShow && (
|
||||||
@@ -223,7 +223,7 @@ class DirOperationToolbar extends React.Component {
|
|||||||
{canUpload && (
|
{canUpload && (
|
||||||
<DropdownItem onClick={this.onUploadFile}>{gettext('Upload')}</DropdownItem>
|
<DropdownItem onClick={this.onUploadFile}>{gettext('Upload')}</DropdownItem>
|
||||||
)}
|
)}
|
||||||
{canModify && (
|
{canCreate && (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<DropdownItem onClick={this.onCreateFolderToggle}>{gettext('New Folder')}</DropdownItem>
|
<DropdownItem onClick={this.onCreateFolderToggle}>{gettext('New Folder')}</DropdownItem>
|
||||||
<DropdownItem onClick={this.onCreateFileToggle}>{gettext('New File')}</DropdownItem>
|
<DropdownItem onClick={this.onCreateFileToggle}>{gettext('New File')}</DropdownItem>
|
||||||
|
@@ -207,7 +207,7 @@ class TreeNodeView extends React.Component {
|
|||||||
|
|
||||||
let menuList = [RENAME, DELETE, COPY, MOVE, OPEN_VIA_CLIENT];
|
let menuList = [RENAME, DELETE, COPY, MOVE, OPEN_VIA_CLIENT];
|
||||||
if (node.object.type === 'dir') {
|
if (node.object.type === 'dir') {
|
||||||
menuList = [NEW_FOLDER, NEW_FILE, COPY, MOVE, RENAME, DELETE];
|
menuList = [NEW_FOLDER, NEW_FILE, COPY, MOVE, RENAME, DELETE];
|
||||||
}
|
}
|
||||||
|
|
||||||
const { userPerm } = this.props;
|
const { userPerm } = this.props;
|
||||||
@@ -217,11 +217,11 @@ class TreeNodeView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
menuList = [];
|
menuList = [];
|
||||||
const { modify: canModify, delete: canDelete, copy: canCopy } = customPermission.permission;
|
const { create: canCreate, modify: canModify, delete: canDelete, copy: canCopy } = customPermission.permission;
|
||||||
if (node.object.type === 'dir') {
|
if (node.object.type === 'dir') {
|
||||||
canModify && menuList.push(NEW_FOLDER, NEW_FILE);
|
canCreate && menuList.push(NEW_FOLDER, NEW_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
canCopy && menuList.push(COPY);
|
canCopy && menuList.push(COPY);
|
||||||
canModify && menuList.push(MOVE, RENAME);
|
canModify && menuList.push(MOVE, RENAME);
|
||||||
canDelete && menuList.push(DELETE);
|
canDelete && menuList.push(DELETE);
|
||||||
|
@@ -270,16 +270,16 @@ class TreeView extends React.Component {
|
|||||||
|
|
||||||
menuList = [];
|
menuList = [];
|
||||||
|
|
||||||
const { modify: canModify, delete: canDelete, copy: canCopy } = customPermission.permission;
|
const { create: canCreate, modify: canModify, delete: canDelete, copy: canCopy } = customPermission.permission;
|
||||||
if (!node) {
|
if (!node) {
|
||||||
canModify && menuList.push(NEW_FOLDER, NEW_FILE);
|
canCreate && menuList.push(NEW_FOLDER, NEW_FILE);
|
||||||
return menuList;
|
return menuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.object.type === 'dir') {
|
if (node.object.type === 'dir') {
|
||||||
canModify && menuList.push(NEW_FOLDER, NEW_FILE);
|
canCreate && menuList.push(NEW_FOLDER, NEW_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
canCopy && menuList.push(COPY);
|
canCopy && menuList.push(COPY);
|
||||||
canModify && menuList.push(MOVE, RENAME);
|
canModify && menuList.push(MOVE, RENAME);
|
||||||
canDelete && menuList.push(DELETE);
|
canDelete && menuList.push(DELETE);
|
||||||
|
Reference in New Issue
Block a user