From 7a46213c8682e1a11afba4325b244275095b76e6 Mon Sep 17 00:00:00 2001 From: ilearnit Date: Mon, 17 Dec 2018 08:04:17 +0000 Subject: [PATCH] add org admin --- frontend/src/components/common/account.js | 7 +++++++ seahub/api2/views.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/frontend/src/components/common/account.js b/frontend/src/components/common/account.js index 796f71b31a..950b699ec3 100644 --- a/frontend/src/components/common/account.js +++ b/frontend/src/components/common/account.js @@ -14,6 +14,7 @@ class Account extends Component { quotaUsage: '', quotaTotal: '', isStaff: false, + isOrgStaff: false, usageRate: '', avatarURL: '', }; @@ -79,6 +80,7 @@ class Account extends Component { quotaUsage: Utils.bytesToSize(resp.data.usage), quotaTotal: Utils.bytesToSize(resp.data.total), isStaff: resp.data.is_staff, + isOrgStaff: resp.data.is_org_staff === 1 ? true : false, avatarURL: resp.data.avatar_url }); }); @@ -90,6 +92,11 @@ class Account extends Component { {gettext('System Admin')} ); } + if (this.state.isOrgStaff) { + return ( + {gettext('Organization Admin')} + ); + } } renderAvatar = () => { diff --git a/seahub/api2/views.py b/seahub/api2/views.py index f0674184d5..678786dde7 100644 --- a/seahub/api2/views.py +++ b/seahub/api2/views.py @@ -300,6 +300,8 @@ class AccountInfo(APIView): org_id = request.user.org.org_id quota_total = seafile_api.get_org_user_quota(org_id, email) quota_usage = seafile_api.get_org_user_quota_usage(org_id, email) + is_org_staff = request.user.org.is_staff + info['is_org_staff'] = is_org_staff else: quota_total = seafile_api.get_user_quota(email) quota_usage = seafile_api.get_user_self_usage(email)