Skip to content

Commit

Permalink
feat: new security and privacy page
Browse files Browse the repository at this point in the history
  • Loading branch information
dougfabris committed Aug 8, 2024
1 parent 48ac718 commit 99c76e9
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,11 @@ registerOmnichannelSidebarItem({
i18nLabel: 'Priorities',
permissionGranted: () => hasAtLeastOnePermission('manage-livechat-priorities'),
});

// TODO: check if new permissions are needed
registerOmnichannelSidebarItem({
href: '/omnichannel/security-privacy',
icon: 'shield-check',
i18nLabel: 'Security_and_privacy',
// permissionGranted: () => hasAtLeastOnePermission('manage-livechat-priorities'),
});
9 changes: 9 additions & 0 deletions apps/meteor/client/omnichannel/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ declare module '@rocket.chat/ui-contexts' {
pattern: '/omnichannel/reports';
pathname: `/omnichannel/reports`;
};
'omnichannel-security-privacy': {
pattern: '/omnichannel/security-privacy';
pathname: `/omnichannel/security-privacy`;
};
}
}

Expand Down Expand Up @@ -51,3 +55,8 @@ registerOmnichannelRoute('/reports', {
name: 'omnichannel-reports',
component: lazy(() => import('./reports/ReportsPage')),
});

registerOmnichannelRoute('/security-privacy', {
name: 'omnichannel-security-privacy',
component: lazy(() => import('./securityPrivacy/SecurityPrivacyRoute')),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { useIsPrivilegedSettingsContext } from '@rocket.chat/ui-contexts';
import React from 'react';

import { useEditableSettingsGroupSections } from '../../views/admin/EditableSettingsContext';
import GroupPage from '../../views/admin/settings/GroupPage';
import Section from '../../views/admin/settings/Section';
import NotAuthorizedPage from '../../views/notAuthorized/NotAuthorizedPage';

const GROUP_ID = 'Omnichannel';
const SECTION_ID = 'Contact_identification';

const SecurityPrivacyPage = () => {
const hasPermission = useIsPrivilegedSettingsContext();
const sections = useEditableSettingsGroupSections(GROUP_ID).filter((id) => id === SECTION_ID);
const solo = sections.length === 1;

if (!hasPermission) {
return <NotAuthorizedPage />;
}

return (
<GroupPage i18nLabel='Security_and_privacy' _id={GROUP_ID}>
{sections.map((sectionName) => (
<Section key={sectionName || ''} groupId={GROUP_ID} sectionName={sectionName} solo={solo} />
))}
</GroupPage>
);
};

export default SecurityPrivacyPage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';

import { useHasLicenseModule } from '../../hooks/useHasLicenseModule';
import SettingsProvider from '../../providers/SettingsProvider';
import EditableSettingsProvider from '../../views/admin/settings/EditableSettingsProvider';
import NotAuthorizedPage from '../../views/notAuthorized/NotAuthorizedPage';
import SecurityPrivacyPage from './SecurityPrivacyPage';

const SecurityPrivacyRoute = () => {
const isEnterprise = useHasLicenseModule('livechat-enterprise');

if (!isEnterprise) {
return <NotAuthorizedPage />;
}

return (
<SettingsProvider privileged>
<EditableSettingsProvider>
<SecurityPrivacyPage />
</EditableSettingsProvider>
</SettingsProvider>
);
};

export default SecurityPrivacyRoute;
3 changes: 2 additions & 1 deletion packages/i18n/src/locales/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -6511,5 +6511,6 @@
"Sidebar_Sections_Order_Description": "Select the categories in your preferred order",
"Incoming_Calls": "Incoming calls",
"Advanced_settings": "Advanced settings",
"Security_and_permissions": "Security and permissions"
"Security_and_permissions": "Security and permissions",
"Security_and_privacy": "Security and privacy"
}

0 comments on commit 99c76e9

Please sign in to comment.