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';
|
||||
|
||||
const propTypes = {
|
||||
forDialog: PropTypes.bool,
|
||||
children: PropTypes.object.isRequired
|
||||
forDialog: PropTypes.bool
|
||||
};
|
||||
|
||||
class EmptyTip extends React.Component {
|
||||
|
@@ -13,7 +13,8 @@ import Rename from '../rename';
|
||||
import { seafileAPI } from '../../utils/seafile-api';
|
||||
import LibHistorySettingDialog from '../dialog/lib-history-setting-dialog';
|
||||
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 = {
|
||||
currentGroup: PropTypes.object,
|
||||
@@ -43,6 +44,7 @@ class SharedRepoListItem extends React.Component {
|
||||
isHistorySettingDialogShow: false,
|
||||
isDeleteDialogShow: false,
|
||||
isAPITokenDialogShow: false,
|
||||
isRepoShareUploadLinksDialogOpen: false
|
||||
};
|
||||
this.isDeparementOnwerGroupMember = false;
|
||||
}
|
||||
@@ -135,6 +137,9 @@ class SharedRepoListItem extends React.Component {
|
||||
case 'API Token':
|
||||
this.onAPITokenToggle();
|
||||
break;
|
||||
case 'Share Links Admin':
|
||||
this.toggleRepoShareUploadLinksDialog();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -186,6 +191,10 @@ class SharedRepoListItem extends React.Component {
|
||||
this.setState({isShowSharedDialog: false});
|
||||
}
|
||||
|
||||
toggleRepoShareUploadLinksDialog = () => {
|
||||
this.setState({isRepoShareUploadLinksDialogOpen: !this.state.isRepoShareUploadLinksDialogOpen});
|
||||
}
|
||||
|
||||
onAPITokenToggle = () => {
|
||||
this.setState({isAPITokenDialogShow: !this.state.isAPITokenDialogShow});
|
||||
}
|
||||
@@ -211,6 +220,9 @@ class SharedRepoListItem extends React.Component {
|
||||
case 'History Setting':
|
||||
translateResult = gettext('History Setting');
|
||||
break;
|
||||
case 'Share Links Admin':
|
||||
translateResult = gettext('Share Links Admin');
|
||||
break;
|
||||
case 'API Token':
|
||||
translateResult = 'API Token'; // translation is not needed here
|
||||
break;
|
||||
@@ -227,19 +239,19 @@ class SharedRepoListItem extends React.Component {
|
||||
let isRepoOwner = repo.owner_email === username;
|
||||
let isAdmin = repo.is_admin;
|
||||
let operations = [];
|
||||
// todo ,shared width me shared width all;
|
||||
if (isPro) {
|
||||
if (repo.owner_email.indexOf('@seafile_group') != -1) { //current repo is belong to a group;
|
||||
if (isStaff && repo.owner_email == currentGroup.id + '@seafile_group') { //is a member of this current group,
|
||||
this.isDeparementOnwerGroupMember = true;
|
||||
if (folderPermEnabled) {
|
||||
operations = ['Rename', 'Folder Permission', 'History Setting', 'Details'];
|
||||
if (repo.owner_email.indexOf('@seafile_group') != -1) {
|
||||
if (isStaff) {
|
||||
if (repo.owner_email == currentGroup.id + '@seafile_group') {
|
||||
this.isDeparementOnwerGroupMember = true;
|
||||
operations = ['Rename'];
|
||||
if (folderPermEnabled) {
|
||||
operations.push('Folder Permission');
|
||||
}
|
||||
operations.push('Share Links Admin', 'History Setting', 'API Token', 'Details');
|
||||
} else {
|
||||
operations = ['Rename', 'Details'];
|
||||
operations.push('Unshare');
|
||||
}
|
||||
operations.push('API Token');
|
||||
} else {
|
||||
operations.push('Unshare');
|
||||
}
|
||||
} else {
|
||||
if (isRepoOwner || isAdmin) {
|
||||
@@ -451,6 +463,14 @@ class SharedRepoListItem extends React.Component {
|
||||
/>
|
||||
</ModalPortal>
|
||||
)}
|
||||
{this.state.isRepoShareUploadLinksDialogOpen && (
|
||||
<ModalPortal>
|
||||
<RepoShareUploadLinksDialog
|
||||
repo={repo}
|
||||
toggleDialog={this.toggleRepoShareUploadLinksDialog}
|
||||
/>
|
||||
</ModalPortal>
|
||||
)}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user