mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-16 00:06:11 +00:00
Merge pull request #4901 from haiwen/admin-device
let admin can delete device on CE version
This commit is contained in:
commit
f0c5c3e74d
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { gettext } from '../../../utils/constants';
|
||||
import { gettext, isPro } from '../../../utils/constants';
|
||||
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
|
||||
|
||||
const propTypes = {
|
||||
@ -36,10 +36,12 @@ class SysAdminUnlinkDevice extends React.Component {
|
||||
<ModalHeader toggle={toggle}>{gettext('Unlink device')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<p>{gettext('Are you sure you want to unlink this device?')}</p>
|
||||
{isPro &&
|
||||
<div className="d-flex align-items-center">
|
||||
<input id="delete-files" className="mr-1" type="checkbox" checked={inputChecked} onChange={this.handleInputChange} />
|
||||
<label htmlFor="delete-files" className="m-0">{gettext('Delete files from this device the next time it comes online.')}</label>
|
||||
</div>
|
||||
}
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={toggle}>{gettext('Cancel')}</Button>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { Component, Fragment } from 'react';
|
||||
import { seafileAPI } from '../../../utils/seafile-api';
|
||||
import { gettext, isPro } from '../../../utils/constants';
|
||||
import { gettext } from '../../../utils/constants';
|
||||
import toaster from '../../../components/toast';
|
||||
import { Utils } from '../../../utils/utils';
|
||||
import EmptyTip from '../../../components/empty-tip';
|
||||
@ -133,9 +133,7 @@ class Item extends Component {
|
||||
<span title={moment(item.last_accessed).format('llll')}>{moment(item.last_accessed).fromNow()}</span>
|
||||
</td>
|
||||
<td>
|
||||
{isPro &&
|
||||
<a href="#" className={`sf2-icon-delete action-icon ${isOpIconShown ? '' : 'invisible'}`} title={gettext('Unlink')} onClick={this.handleUnlink}></a>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
{isUnlinkDeviceDialogOpen &&
|
||||
|
@ -9,6 +9,7 @@ from rest_framework import status
|
||||
|
||||
from pysearpc import SearpcError
|
||||
|
||||
from seahub.utils import is_pro_version
|
||||
from seahub.utils.devices import do_unlink_device
|
||||
from seahub.utils.timeutils import datetime_to_isoformat_timestr
|
||||
|
||||
@ -20,6 +21,7 @@ from seahub.base.templatetags.seahub_tags import email2nickname
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AdminDevices(APIView):
|
||||
authentication_classes = (TokenAuthentication, SessionAuthentication)
|
||||
throttle_classes = (UserRateThrottle,)
|
||||
@ -75,7 +77,7 @@ class AdminDevices(APIView):
|
||||
|
||||
def delete(self, request, format=None):
|
||||
|
||||
if not request.user.admin_permissions.other_permission():
|
||||
if is_pro_version() and not request.user.admin_permissions.other_permission():
|
||||
return api_error(status.HTTP_403_FORBIDDEN, 'Permission denied.')
|
||||
|
||||
platform = request.data.get('platform', '')
|
||||
|
Loading…
Reference in New Issue
Block a user