mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-01 23:38:37 +00:00
added the link to institution admin panel (#4090)
This commit is contained in:
parent
cbfe203a26
commit
69645a77c9
@ -77,6 +77,7 @@ class Account extends Component {
|
||||
quotaUsage: Utils.bytesToSize(resp.data.usage),
|
||||
quotaTotal: Utils.bytesToSize(resp.data.total),
|
||||
isStaff: resp.data.is_staff,
|
||||
isInstAdmin: resp.data.is_inst_admin,
|
||||
isOrgStaff: resp.data.is_org_staff === 1 ? true : false,
|
||||
showInfo: !this.state.showInfo,
|
||||
});
|
||||
@ -91,29 +92,47 @@ class Account extends Component {
|
||||
}
|
||||
|
||||
renderMenu = () => {
|
||||
if (this.state.isStaff && this.props.isAdminPanel) {
|
||||
return (
|
||||
<a href={siteRoot} title={gettext('Exit Admin Panel')} className="item">{gettext('Exit Admin Panel')}</a>
|
||||
);
|
||||
let data;
|
||||
const { isStaff, isOrgStaff, isInstAdmin } = this.state;
|
||||
|
||||
if (this.props.isAdminPanel) {
|
||||
if (isStaff) {
|
||||
data = {
|
||||
url: siteRoot,
|
||||
text: gettext('Exit System Admin')
|
||||
};
|
||||
} else if (isOrgStaff) {
|
||||
data = {
|
||||
url: siteRoot,
|
||||
text: gettext('Exit Organization Admin')
|
||||
};
|
||||
} else if (isInstAdmin) {
|
||||
data = {
|
||||
url: siteRoot,
|
||||
text: gettext('Exit Institution Admin')
|
||||
};
|
||||
}
|
||||
|
||||
} else {
|
||||
if (isStaff) {
|
||||
data = {
|
||||
url: `${siteRoot}sys/useradmin/`,
|
||||
text: gettext('System Admin')
|
||||
};
|
||||
} else if (isOrgStaff) {
|
||||
data = {
|
||||
url: `${siteRoot}org/useradmin/`,
|
||||
text: gettext('Organization Admin')
|
||||
};
|
||||
} else if (isInstAdmin) {
|
||||
data = {
|
||||
url: `${siteRoot}inst/useradmin/`,
|
||||
text: gettext('Institution Admin')
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (this.state.isOrgStaff && this.props.isAdminPanel) {
|
||||
return (
|
||||
<a href={siteRoot} title={gettext('Exit Organization Admin')} className="item">{gettext('Exit Organization Admin')}</a>
|
||||
);
|
||||
}
|
||||
|
||||
if (this.state.isStaff) {
|
||||
return (
|
||||
<a href={siteRoot + 'sys/useradmin/'} title={gettext('System Admin')} className="item">{gettext('System Admin')}</a>
|
||||
);
|
||||
}
|
||||
|
||||
if (this.state.isOrgStaff) {
|
||||
return (
|
||||
<a href={siteRoot + 'org/useradmin/'} title={gettext('Organization Admin')} className="item">{gettext('Organization Admin')}</a>
|
||||
);
|
||||
}
|
||||
return data && <a href={data.url} title={data.text} className="item">{data.text}</a>;
|
||||
}
|
||||
|
||||
renderAvatar = () => {
|
||||
|
@ -329,6 +329,9 @@ class AccountInfo(APIView):
|
||||
info['institution'] = p.institution if p and p.institution else ""
|
||||
info['is_staff'] = request.user.is_staff
|
||||
|
||||
if getattr(settings, 'MULTI_INSTITUTION', False):
|
||||
info['is_inst_admin'] = request.user.inst_admin
|
||||
|
||||
interval = UserOptions.objects.get_file_updates_email_interval(email)
|
||||
info['email_notification_interval'] = 0 if interval is None else interval
|
||||
return info
|
||||
|
@ -16,6 +16,7 @@ class InstitutionMiddleware(object):
|
||||
try:
|
||||
inst_admin = InstitutionAdmin.objects.get(user=username)
|
||||
except InstitutionAdmin.DoesNotExist:
|
||||
request.user.inst_admin = False
|
||||
return None
|
||||
|
||||
request.user.institution = inst_admin.institution
|
||||
|
Loading…
Reference in New Issue
Block a user