Commit 5cd1b1af authored by Jesús Espino's avatar Jesús Espino Committed by George Goldberg
Browse files

MM-10710: Hide schemes list view on E10 (#1259)

parent 596ff745
......@@ -494,26 +494,38 @@ export default class AdminSidebar extends React.Component {
}
/>
</AdminSidebarSection>
<AdminSidebarSection
name='permissions'
type='text'
title={
<FormattedMessage
id='admin.sidebar.permissions'
defaultMessage='Permissions'
/>
}
>
{this.props.license.IsLicensed === 'true' &&
<AdminSidebarSection
name='schemes'
name='permissions'
type='text'
title={
<FormattedMessage
id='admin.sidebar.schemes'
defaultMessage='Permission Schemes'
id='admin.sidebar.permissions'
defaultMessage='Permissions'
/>
}
/>
</AdminSidebarSection>
>
{this.props.license.CustomPermissionsSchemes !== 'true' &&
<AdminSidebarSection
name='system-scheme'
title={
<FormattedMessage
id='admin.sidebar.system-scheme'
defaultMessage='System scheme'
/>
}
/>}
{this.props.license.CustomPermissionsSchemes === 'true' &&
<AdminSidebarSection
name='schemes'
title={
<FormattedMessage
id='admin.sidebar.schemes'
defaultMessage='Permission Schemes'
/>
}
/>}
</AdminSidebarSection>}
<AdminSidebarSection
name='authentication'
type='text'
......
......@@ -20,6 +20,7 @@ import PermissionsTree from '../permissions_tree.jsx';
export default class PermissionSystemSchemeSettings extends React.Component {
static propTypes = {
roles: PropTypes.object.isRequired,
license: PropTypes.object.isRequired,
actions: PropTypes.shape({
loadRolesIfNeeded: PropTypes.func.isRequired,
editRole: PropTypes.func.isRequired,
......@@ -182,19 +183,21 @@ export default class PermissionSystemSchemeSettings extends React.Component {
}
render = () => {
const hasCustomSchemes = this.props.license.CustomPermissionsSchemes === 'true';
if (!this.state.loaded) {
return <LoadingScreen/>;
}
return (
<div className='wrapper--fixed'>
<h3 className='admin-console-header with-back'>
<Link
to='/admin_console/permissions/schemes'
className='fa fa-chevron-left back'
/>
<h3 className={'admin-console-header ' + (hasCustomSchemes ? 'with-back' : '')}>
{hasCustomSchemes &&
<Link
to='/admin_console/permissions/schemes'
className='fa fa-chevron-left back'
/>}
<FormattedMessage
id='admin.permissions.permissionSchemes'
defaultMessage='Permission Schemes'
id='admin.permissions.systemScheme'
defaultMessage='System Scheme'
/>
</h3>
......
......@@ -246,6 +246,7 @@
"admin.permissions.systemSchemeBannerTitle": "System Scheme",
"admin.permissions.systemSchemeBannerText": "Set the default permissions inherited by all teams unless a Team Override Scheme is applied.",
"admin.permissions.systemSchemeBannerButton": "Edit Scheme",
"admin.permissions.systemScheme": "System Scheme",
"admin.permissions.systemScheme.introBanner": "Configure the default permissions for Team Admins, Channel Admins and other members. This scheme is inherited by all teams unless a Team Override Scheme is applied in specific teams.",
"admin.permissions.systemScheme.allMembersTitle": "All Members",
"admin.permissions.systemScheme.allMembersDescription": "Permissions granted to all members, including administrators and newly created users.",
......@@ -259,7 +260,7 @@
"admin.permissions.systemScheme.resetDefaultsButtonModalTitle": "Reset to Default?",
"admin.permissions.systemScheme.resetDefaultsButtonModalBody": "This will reset all selections on this page to their default settings. Are you sure you want to reset?",
"admin.permissions.systemScheme.resetDefaultsConfirmationButton": "Yes, Reset",
"admin.permissions.teamScheme": "Team Scheme.",
"admin.permissions.teamScheme": "Team Scheme",
"admin.permissions.teamScheme.introBanner": "Team Override Schemes set the permissions for Team Admins, Channel Admins and other members in specific teams. Use a Team Override Scheme when specific teams need permission exceptions to the <a href=\"/admin_console/permissions/system-scheme\">System Scheme</a>.",
"admin.permissions.teamScheme.schemeDetailsTitle": "Scheme Details",
"admin.permissions.teamScheme.schemeDetailsDescription": "Set the name and description for this scheme.",
......@@ -1207,6 +1208,8 @@
"admin.sidebar.usersAndTeams": "Users and Teams",
"admin.sidebar.view_statistics": "Site Statistics",
"admin.sidebar.webrtc": "WebRTC (Beta)",
"admin.sidebar.schemes": "Permission Schemes",
"admin.sidebar.system-scheme": "System Scheme",
"admin.sidebarHeader.systemConsole": "System Console",
"admin.sql.dataSource": "Data Source:",
"admin.sql.driverName": "Driver Name:",
......
......@@ -13,8 +13,8 @@ exports[`components/admin_console/permission_schemes_settings/permission_system_
to="/admin_console/permissions/schemes"
/>
<FormattedMessage
defaultMessage="Permission Schemes"
id="admin.permissions.permissionSchemes"
defaultMessage="System Scheme"
id="admin.permissions.systemScheme"
values={Object {}}
/>
</h3>
......@@ -431,6 +431,338 @@ Object {
}
`;
exports[`components/admin_console/permission_schemes_settings/permission_system_scheme_settings/permission_system_scheme_settings should match snapshot when the license doesnt have custom schemes 1`] = `
<div
className="wrapper--fixed"
>
<h3
className="admin-console-header "
>
<FormattedMessage
defaultMessage="System Scheme"
id="admin.permissions.systemScheme"
values={Object {}}
/>
</h3>
<div
className="banner info"
>
<div
className="banner__content"
>
<span>
<FormattedMessage
defaultMessage="Configure the default permissions for Team Admins, Channel Admins and other members. This scheme is inherited by all teams unless a Team Override Scheme is applied in specific teams."
id="admin.permissions.systemScheme.introBanner"
values={Object {}}
/>
</span>
</div>
</div>
<div
className="permissions-block "
id="all_users"
>
<div
className="header"
onClick={[Function]}
>
<div>
<h3>
<FormattedMessage
defaultMessage="All Members"
id="admin.permissions.systemScheme.allMembersTitle"
values={Object {}}
/>
</h3>
<span>
<FormattedMessage
defaultMessage="Permissions granted to all members, including administrators and newly created users."
id="admin.permissions.systemScheme.allMembersDescription"
values={Object {}}
/>
</span>
</div>
<div
className="button"
>
<AccordionToggleIcon />
</div>
</div>
<PermissionsTree
onToggle={[Function]}
role={
Object {
"displayName": "All members",
"name": "all_users",
"permissions": Array [],
}
}
scope="system_scope"
selectRow={[Function]}
selected={null}
/>
</div>
<div
className="permissions-block "
>
<div
className="header"
onClick={[Function]}
>
<div>
<h3>
<FormattedMessage
defaultMessage="Channel Administrators"
id="admin.permissions.systemScheme.channelAdminsTitle"
values={Object {}}
/>
</h3>
<span>
<FormattedMessage
defaultMessage="Permissions granted to channel creators and any users promoted to Channel Administrator."
id="admin.permissions.systemScheme.channelAdminsDescription"
values={Object {}}
/>
</span>
</div>
<div
className="button"
>
<AccordionToggleIcon />
</div>
</div>
<PermissionsTree
onToggle={[Function]}
parentRole={
Object {
"displayName": "All members",
"name": "all_users",
"permissions": Array [],
}
}
role={
Object {
"permissions": Array [],
}
}
scope="channel_scope"
selectRow={[Function]}
/>
</div>
<div
className="permissions-block "
>
<div
className="header"
onClick={[Function]}
>
<div>
<h3>
<FormattedMessage
defaultMessage="Team Administrators"
id="admin.permissions.systemScheme.teamAdminsTitle"
values={Object {}}
/>
</h3>
<span>
<FormattedMessage
defaultMessage="Permissions granted to team creators and any users promoted to Team Administrator."
id="admin.permissions.systemScheme.teamAdminsDescription"
values={Object {}}
/>
</span>
</div>
<div
className="button"
>
<AccordionToggleIcon />
</div>
</div>
<PermissionsTree
onToggle={[Function]}
parentRole={
Object {
"displayName": "All members",
"name": "all_users",
"permissions": Array [],
}
}
role={
Object {
"permissions": Array [],
}
}
scope="team_scope"
selectRow={[Function]}
/>
</div>
<div
className="permissions-block "
>
<div
className="header"
onClick={[Function]}
>
<div>
<h3>
<FormattedMessage
defaultMessage="System Administrators"
id="admin.permissions.systemScheme.systemAdminsTitle"
values={Object {}}
/>
</h3>
<span>
<FormattedMessage
defaultMessage="Full permissions granted to System Administrators."
id="admin.permissions.systemScheme.systemAdminsDescription"
values={Object {}}
/>
</span>
</div>
<div
className="button"
>
<AccordionToggleIcon />
</div>
</div>
<PermissionsTree
onToggle={[Function]}
readOnly={true}
role={
Object {
"permissions": Array [],
}
}
scope="system_scope"
selectRow={[Function]}
/>
</div>
<div
className="admin-console-save"
>
<SaveButton
btnClass="btn-primary"
defaultMessage="Save"
disabled={true}
extraClasses=""
onClick={[Function]}
saving={false}
savingMessage="Saving Config..."
/>
<Link
className="cancel-button"
replace={false}
to="/admin_console/permissions/schemes"
>
<FormattedMessage
defaultMessage="Cancel"
id="admin.permissions.permissionSchemes.cancel"
values={Object {}}
/>
</Link>
<a
className="cancel-button reset-defaults-btn"
onClick={[Function]}
>
<FormattedMessage
defaultMessage="Reset to Defaults"
id="admin.permissions.systemScheme.resetDefaultsButton"
values={Object {}}
/>
</a>
<div
className="error-message"
>
<FormError
error={null}
errors={Array []}
/>
</div>
</div>
<Modal
animation={true}
autoFocus={true}
backdrop={true}
bsClass="modal"
dialogClassName="admin-modal"
dialogComponentClass={[Function]}
enforceFocus={true}
keyboard={true}
manager={
ModalManager {
"add": [Function],
"containers": Array [],
"data": Array [],
"handleContainerOverflow": true,
"hideSiblingNodes": true,
"isTopModal": [Function],
"modals": Array [],
"remove": [Function],
}
}
onHide={[Function]}
renderBackdrop={[Function]}
restoreFocus={true}
show={false}
>
<ModalHeader
bsClass="modal-header"
closeButton={true}
closeLabel="Close"
>
<h4
className="modal-title"
>
<FormattedMessage
defaultMessage="Reset to Default?"
id="admin.permissions.systemScheme.resetDefaultsButtonModalTitle"
values={Object {}}
/>
</h4>
</ModalHeader>
<ModalBody
bsClass="modal-body"
componentClass="div"
>
<FormattedMessage
defaultMessage="This will reset all selections on this page to their default settings. Are you sure you want to reset?"
id="admin.permissions.systemScheme.resetDefaultsButtonModalBody"
values={Object {}}
/>
</ModalBody>
<ModalFooter
bsClass="modal-footer"
componentClass="div"
>
<button
className="btn btn-cancel"
onClick={[Function]}
type="button"
>
<FormattedMessage
defaultMessage="Cancel"
id="confirm_modal.cancel"
values={Object {}}
/>
</button>
<button
className="btn btn-default"
id="linkModalCloseButton"
onClick={[Function]}
type="button"
>
<FormattedMessage
defaultMessage="Yes, Reset"
id="admin.permissions.systemScheme.resetDefaultsConfirmationButton"
values={Object {}}
/>
</button>
</ModalFooter>
</Modal>
</div>
`;
exports[`components/admin_console/permission_schemes_settings/permission_system_scheme_settings/permission_system_scheme_settings should save each role on save clicked except system_admin role 1`] = `
<div
className="wrapper--fixed"
......@@ -444,8 +776,8 @@ exports[`components/admin_console/permission_schemes_settings/permission_system_
to="/admin_console/permissions/schemes"
/>
<FormattedMessage
defaultMessage="Permission Schemes"
id="admin.permissions.permissionSchemes"
defaultMessage="System Scheme"
id="admin.permissions.systemScheme"
values={Object {}}
/>
</h3>
......
......@@ -10,6 +10,10 @@ import {DefaultRolePermissions} from 'utils/constants.jsx';
describe('components/admin_console/permission_schemes_settings/permission_system_scheme_settings/permission_system_scheme_settings', () => {
const defaultProps = {
license: {
IsLicensed: 'true',
CustomPermissionsSchemes: 'true',
},
location: {},
roles: {
system_user: {
......@@ -47,6 +51,23 @@ describe('components/admin_console/permission_schemes_settings/permission_system
});
});
test('should match snapshot when the license doesnt have custom schemes', (done) => {
const license = {
IsLicensed: 'true',
CustomPermissionsSchemes: 'false',
};
const wrapper = shallow(
<PermissionSystemSchemeSettings
{...defaultProps}
license={license}
/>
);
defaultProps.actions.loadRolesIfNeeded().then(() => {
expect(wrapper).toMatchSnapshot();
done();
});
});
test('should match snapshot on roles with permissions', (done) => {
const roles = {
system_user: {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment