mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 17:33:18 +00:00
added 'share links admin' to 'department repo' for 'department Admin' (#4475)
* added 'share links admin' to 'department repo' for 'department Admin' * [department repo] fixup
This commit is contained in:
@@ -3,8 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
import { mediaUrl } from '../utils/constants';
|
import { mediaUrl } from '../utils/constants';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
forDialog: PropTypes.bool,
|
forDialog: PropTypes.bool
|
||||||
children: PropTypes.object.isRequired
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class EmptyTip extends React.Component {
|
class EmptyTip extends React.Component {
|
||||||
|
@@ -13,7 +13,8 @@ import Rename from '../rename';
|
|||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import LibHistorySettingDialog from '../dialog/lib-history-setting-dialog';
|
import LibHistorySettingDialog from '../dialog/lib-history-setting-dialog';
|
||||||
import toaster from '../toast';
|
import toaster from '../toast';
|
||||||
import RepoAPITokenDialog from "../dialog/repo-api-token-dialog";
|
import RepoAPITokenDialog from '../dialog/repo-api-token-dialog';
|
||||||
|
import RepoShareUploadLinksDialog from '../dialog/repo-share-upload-links-dialog';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
currentGroup: PropTypes.object,
|
currentGroup: PropTypes.object,
|
||||||
@@ -43,6 +44,7 @@ class SharedRepoListItem extends React.Component {
|
|||||||
isHistorySettingDialogShow: false,
|
isHistorySettingDialogShow: false,
|
||||||
isDeleteDialogShow: false,
|
isDeleteDialogShow: false,
|
||||||
isAPITokenDialogShow: false,
|
isAPITokenDialogShow: false,
|
||||||
|
isRepoShareUploadLinksDialogOpen: false
|
||||||
};
|
};
|
||||||
this.isDeparementOnwerGroupMember = false;
|
this.isDeparementOnwerGroupMember = false;
|
||||||
}
|
}
|
||||||
@@ -135,6 +137,9 @@ class SharedRepoListItem extends React.Component {
|
|||||||
case 'API Token':
|
case 'API Token':
|
||||||
this.onAPITokenToggle();
|
this.onAPITokenToggle();
|
||||||
break;
|
break;
|
||||||
|
case 'Share Links Admin':
|
||||||
|
this.toggleRepoShareUploadLinksDialog();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -186,6 +191,10 @@ class SharedRepoListItem extends React.Component {
|
|||||||
this.setState({isShowSharedDialog: false});
|
this.setState({isShowSharedDialog: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleRepoShareUploadLinksDialog = () => {
|
||||||
|
this.setState({isRepoShareUploadLinksDialogOpen: !this.state.isRepoShareUploadLinksDialogOpen});
|
||||||
|
}
|
||||||
|
|
||||||
onAPITokenToggle = () => {
|
onAPITokenToggle = () => {
|
||||||
this.setState({isAPITokenDialogShow: !this.state.isAPITokenDialogShow});
|
this.setState({isAPITokenDialogShow: !this.state.isAPITokenDialogShow});
|
||||||
}
|
}
|
||||||
@@ -211,6 +220,9 @@ class SharedRepoListItem extends React.Component {
|
|||||||
case 'History Setting':
|
case 'History Setting':
|
||||||
translateResult = gettext('History Setting');
|
translateResult = gettext('History Setting');
|
||||||
break;
|
break;
|
||||||
|
case 'Share Links Admin':
|
||||||
|
translateResult = gettext('Share Links Admin');
|
||||||
|
break;
|
||||||
case 'API Token':
|
case 'API Token':
|
||||||
translateResult = 'API Token'; // translation is not needed here
|
translateResult = 'API Token'; // translation is not needed here
|
||||||
break;
|
break;
|
||||||
@@ -227,19 +239,19 @@ class SharedRepoListItem extends React.Component {
|
|||||||
let isRepoOwner = repo.owner_email === username;
|
let isRepoOwner = repo.owner_email === username;
|
||||||
let isAdmin = repo.is_admin;
|
let isAdmin = repo.is_admin;
|
||||||
let operations = [];
|
let operations = [];
|
||||||
// todo ,shared width me shared width all;
|
|
||||||
if (isPro) {
|
if (isPro) {
|
||||||
if (repo.owner_email.indexOf('@seafile_group') != -1) { //current repo is belong to a group;
|
if (repo.owner_email.indexOf('@seafile_group') != -1) {
|
||||||
if (isStaff && repo.owner_email == currentGroup.id + '@seafile_group') { //is a member of this current group,
|
if (isStaff) {
|
||||||
this.isDeparementOnwerGroupMember = true;
|
if (repo.owner_email == currentGroup.id + '@seafile_group') {
|
||||||
if (folderPermEnabled) {
|
this.isDeparementOnwerGroupMember = true;
|
||||||
operations = ['Rename', 'Folder Permission', 'History Setting', 'Details'];
|
operations = ['Rename'];
|
||||||
|
if (folderPermEnabled) {
|
||||||
|
operations.push('Folder Permission');
|
||||||
|
}
|
||||||
|
operations.push('Share Links Admin', 'History Setting', 'API Token', 'Details');
|
||||||
} else {
|
} else {
|
||||||
operations = ['Rename', 'Details'];
|
operations.push('Unshare');
|
||||||
}
|
}
|
||||||
operations.push('API Token');
|
|
||||||
} else {
|
|
||||||
operations.push('Unshare');
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isRepoOwner || isAdmin) {
|
if (isRepoOwner || isAdmin) {
|
||||||
@@ -451,6 +463,14 @@ class SharedRepoListItem extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</ModalPortal>
|
</ModalPortal>
|
||||||
)}
|
)}
|
||||||
|
{this.state.isRepoShareUploadLinksDialogOpen && (
|
||||||
|
<ModalPortal>
|
||||||
|
<RepoShareUploadLinksDialog
|
||||||
|
repo={repo}
|
||||||
|
toggleDialog={this.toggleRepoShareUploadLinksDialog}
|
||||||
|
/>
|
||||||
|
</ModalPortal>
|
||||||
|
)}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user