mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-22 16:56:57 +00:00
sysadmin page display org_saml_config (#5573)
This commit is contained in:
parent
70b22dd632
commit
b89c06ee5a
@ -1,7 +1,8 @@
|
||||
import React, { Component, Fragment } from 'react';
|
||||
import { Row, Col } from 'reactstrap';
|
||||
import { Utils } from '../../../utils/utils';
|
||||
import { seafileAPI } from '../../../utils/seafile-api';
|
||||
import { gettext } from '../../../utils/constants';
|
||||
import { gettext, serviceURL } from '../../../utils/constants';
|
||||
import toaster from '../../../components/toast';
|
||||
import Loading from '../../../components/loading';
|
||||
import SysAdminSetOrgQuotaDialog from '../../../components/dialog/sysadmin-dialog/set-quota';
|
||||
@ -50,7 +51,7 @@ class Content extends Component {
|
||||
} else if (errorMsg) {
|
||||
return <p className="error text-center">{errorMsg}</p>;
|
||||
} else {
|
||||
const { org_name, users_count, max_user_number, groups_count, quota, quota_usage } = this.props.orgInfo;
|
||||
const { org_name, users_count, max_user_number, groups_count, quota, quota_usage, enable_saml_login, url_prefix, metadata_url, domain } = this.props.orgInfo;
|
||||
const { isSetQuotaDialogOpen, isSetNameDialogOpen, isSetMaxUserNumberDialogOpen } = this.state;
|
||||
return (
|
||||
<Fragment>
|
||||
@ -82,6 +83,29 @@ class Content extends Component {
|
||||
{`${Utils.bytesToSize(quota_usage)} / ${quota > 0 ? Utils.bytesToSize(quota) : '--'}`}
|
||||
{this.showEditIcon(this.toggleSetQuotaDialog)}
|
||||
</dd>
|
||||
{enable_saml_login &&
|
||||
<Fragment>
|
||||
<dt className="info-item-heading">{gettext('SAML Config')}</dt>
|
||||
<dd className="info-item-content">
|
||||
<Row className="my-4">
|
||||
<Col md="3">{gettext('Custom SAML Login URL')}</Col>
|
||||
<Col md="6">{`${serviceURL}/org/custom/${url_prefix}`}</Col>
|
||||
</Row>
|
||||
</dd>
|
||||
<dd className="info-item-content">
|
||||
<Row className="my-4">
|
||||
<Col md="3">{gettext('App Federation Metadata URL')}</Col>
|
||||
<Col md="6">{metadata_url}</Col>
|
||||
</Row>
|
||||
</dd>
|
||||
<dd className="info-item-content">
|
||||
<Row className="my-4">
|
||||
<Col md="3">{gettext('Email Domain')}</Col>
|
||||
<Col md="6">{domain}</Col>
|
||||
</Row>
|
||||
</dd>
|
||||
</Fragment>
|
||||
}
|
||||
</dl>
|
||||
{isSetQuotaDialogOpen &&
|
||||
<SysAdminSetOrgQuotaDialog
|
||||
|
@ -22,6 +22,7 @@ from seahub.api2.throttling import UserRateThrottle
|
||||
from seahub.api2.utils import api_error
|
||||
from seahub.api2.permissions import IsProVersion
|
||||
from seahub.role_permissions.utils import get_available_roles
|
||||
from seahub.organizations.models import OrgSAMLConfig
|
||||
|
||||
try:
|
||||
from seahub.settings import ORG_MEMBER_QUOTA_ENABLED
|
||||
@ -37,6 +38,11 @@ try:
|
||||
except ImportError:
|
||||
MULTI_TENANCY = False
|
||||
|
||||
try:
|
||||
from seahub.settings import ENABLE_MULTI_ADFS
|
||||
except ImportError:
|
||||
ENABLE_MULTI_ADFS = False
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def get_org_info(org):
|
||||
@ -77,6 +83,16 @@ def get_org_detailed_info(org):
|
||||
groups = ccnet_api.get_org_groups(org_id, -1, -1)
|
||||
org_info['groups_count'] = len(groups)
|
||||
|
||||
# saml config
|
||||
org_info['enable_saml_login'] = False
|
||||
if ENABLE_MULTI_ADFS:
|
||||
org_saml_config = OrgSAMLConfig.objects.get_config_by_org_id(org_id)
|
||||
if org_saml_config:
|
||||
org_info['enable_saml_login'] = True
|
||||
org_info['url_prefix'] = org.url_prefix
|
||||
org_info['metadata_url'] = org_saml_config.metadata_url
|
||||
org_info['domain'] = org_saml_config.domain
|
||||
|
||||
return org_info
|
||||
|
||||
def gen_org_url_prefix(max_trial=None, length=20):
|
||||
|
Loading…
Reference in New Issue
Block a user