mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 09:21:54 +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>
|
||||||
|
@@ -335,8 +335,8 @@ class DirentListView extends React.Component {
|
|||||||
|
|
||||||
// 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>
|
||||||
|
@@ -217,9 +217,9 @@ 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);
|
||||||
|
@@ -270,14 +270,14 @@ 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);
|
||||||
|
Reference in New Issue
Block a user