Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Omnichannel's security and privacy settings page #32988

Merged
merged 4 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/lazy-icons-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/i18n': minor
'@rocket.chat/meteor': minor
---

Renders the security and privacy settings page inside Omnichannel administration
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,10 @@ registerOmnichannelSidebarItem({
i18nLabel: 'Priorities',
permissionGranted: () => hasAtLeastOnePermission('manage-livechat-priorities'),
});

registerOmnichannelSidebarItem({
href: '/omnichannel/security-privacy',
icon: 'shield-check',
i18nLabel: 'Security_and_privacy',
permissionGranted: () => hasAtLeastOnePermission(['view-privileged-setting', 'edit-privileged-setting', 'manage-selected-settings']),
});
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,22 @@
import { useIsPrivilegedSettingsContext } from '@rocket.chat/ui-contexts';
import React from 'react';

import { useEditableSettingsGroupSections } from '../../views/admin/EditableSettingsContext';
import GenericGroupPage from '../../views/admin/settings/groups/GenericGroupPage';
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);

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

return <GenericGroupPage i18nLabel='Security_and_privacy' sections={sections} _id={GROUP_ID} />;
};

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;
4 changes: 0 additions & 4 deletions apps/meteor/ee/app/livechat-enterprise/server/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ export const createSettings = async (): Promise<void> => {
await this.add('Livechat_Block_Unknown_Contacts', false, {
type: 'boolean',
public: true,
hidden: true,
enableQuery: omnichannelEnabledQuery,
invalidValue: false,
section: 'Contact_identification',
Expand All @@ -181,7 +180,6 @@ export const createSettings = async (): Promise<void> => {
await this.add('Livechat_Block_Unverified_Contacts', false, {
type: 'boolean',
public: true,
hidden: true,
enableQuery: omnichannelEnabledQuery,
invalidValue: false,
section: 'Contact_identification',
Expand All @@ -192,7 +190,6 @@ export const createSettings = async (): Promise<void> => {
await this.add('Livechat_Contact_Verification_App', '', {
type: 'select',
public: true,
hidden: true,
values: [{ key: 'VerifyChat', i18nLabel: 'VerifyChat' }],
enableQuery: omnichannelEnabledQuery,
invalidValue: '',
Expand All @@ -204,7 +201,6 @@ export const createSettings = async (): Promise<void> => {
await this.add('Livechat_Request_Verification_On_First_Contact_Only', false, {
type: 'boolean',
public: true,
hidden: true,
enableQuery: omnichannelEnabledQuery,
invalidValue: false,
section: 'Contact_identification',
Expand Down
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 @@ -6514,5 +6514,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"
}
Loading