1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 01:44:13 +00:00

add pro check for list departments (#4329)

This commit is contained in:
Leo
2019-12-02 11:56:46 +08:00
committed by Daniel Pan
parent d81d05ea2a
commit 0dfc17ce2c
2 changed files with 18 additions and 12 deletions

View File

@@ -37,18 +37,20 @@ class TransferDialog extends React.Component {
}
componentDidMount() {
seafileAPI.listDepartments().then((res) => {
for (let i = 0 ; i < res.data.length; i++) {
let obj = {};
obj.value = res.data[i].name;
obj.email = res.data[i].email;
obj.label = res.data[i].name;
this.options.push(obj);
}
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
toaster.danger(errMessage);
});
if (isPro) {
seafileAPI.listDepartments().then((res) => {
for (let i = 0 ; i < res.data.length; i++) {
let obj = {};
obj.value = res.data[i].name;
obj.email = res.data[i].email;
obj.label = res.data[i].name;
this.options.push(obj);
}
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
toaster.danger(errMessage);
});
}
}
onClick = () => {

View File

@@ -14,6 +14,7 @@ from seahub.api2.utils import api_error
from seahub.api2.authentication import TokenAuthentication
from seahub.api2.throttling import UserRateThrottle
from seahub.avatar.templatetags.group_avatar_tags import api_grp_avatar_url, get_default_group_avatar_url
from seahub.utils import is_pro_version
from seahub.utils.timeutils import timestamp_to_isoformat_timestr
from seahub.group.utils import is_group_member
from seahub.avatar.settings import GROUP_AVATAR_DEFAULT_SIZE
@@ -31,6 +32,9 @@ class Departments(APIView):
"""list all departments
"""
if not is_pro_version():
return api_error(status.HTTP_403_FORBIDDEN, 'Permission denied.')
try:
departments = ccnet_api.list_all_departments()
except Exception as e: