Add server settings to further lock files on mobile (#30949)
* Add server settings to further lock files on mobile * fix format with prettier --------- Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: Saturnino Abril <5334504+saturninoabril@users.noreply.github.com>
Этот коммит содержится в:
@@ -566,6 +566,8 @@ const defaultServerConfig: AdminConfig = {
|
||||
MobileEnableBiometrics: false,
|
||||
MobilePreventScreenCapture: false,
|
||||
MobileJailbreakProtection: false,
|
||||
MobileEnableSecureFilePreview: false,
|
||||
MobileAllowPdfLinkNavigation: false,
|
||||
},
|
||||
CacheSettings: {
|
||||
CacheType: 'lru',
|
||||
|
||||
@@ -15,6 +15,10 @@ export default class MobileSecurity {
|
||||
readonly preventScreenCaptureToggleFalse: Locator;
|
||||
readonly jailbreakProtectionToggleTrue: Locator;
|
||||
readonly jailbreakProtectionToggleFalse: Locator;
|
||||
readonly enableSecureFilePreviewToggleTrue: Locator;
|
||||
readonly enableSecureFilePreviewToggleFalse: Locator;
|
||||
readonly allowPdfLinkNavigationToggleTrue: Locator;
|
||||
readonly allowPdfLinkNavigationToggleFalse: Locator;
|
||||
|
||||
readonly saveButton: Locator;
|
||||
|
||||
@@ -42,6 +46,27 @@ export default class MobileSecurity {
|
||||
'NativeAppSettings.MobileJailbreakProtectionfalse',
|
||||
);
|
||||
|
||||
this.jailbreakProtectionToggleTrue = this.container.getByTestId(
|
||||
'NativeAppSettings.MobileJailbreakProtectiontrue',
|
||||
);
|
||||
this.jailbreakProtectionToggleFalse = this.container.getByTestId(
|
||||
'NativeAppSettings.MobileJailbreakProtectionfalse',
|
||||
);
|
||||
|
||||
this.enableSecureFilePreviewToggleTrue = this.container.getByTestId(
|
||||
'NativeAppSettings.MobileEnableSecureFilePreviewtrue',
|
||||
);
|
||||
this.enableSecureFilePreviewToggleFalse = this.container.getByTestId(
|
||||
'NativeAppSettings.MobileEnableSecureFilePreviewfalse',
|
||||
);
|
||||
|
||||
this.allowPdfLinkNavigationToggleTrue = this.container.getByTestId(
|
||||
'NativeAppSettings.MobileAllowPdfLinkNavigationtrue',
|
||||
);
|
||||
this.allowPdfLinkNavigationToggleFalse = this.container.getByTestId(
|
||||
'NativeAppSettings.MobileAllowPdfLinkNavigationfalse',
|
||||
);
|
||||
|
||||
this.saveButton = this.container.getByRole('button', {name: 'Save'});
|
||||
}
|
||||
|
||||
@@ -73,6 +98,22 @@ export default class MobileSecurity {
|
||||
await this.jailbreakProtectionToggleFalse.click();
|
||||
}
|
||||
|
||||
async clickEnableSecureFilePreviewToggleTrue() {
|
||||
await this.enableSecureFilePreviewToggleTrue.click();
|
||||
}
|
||||
|
||||
async clickEnableSecureFilePreviewToggleFalse() {
|
||||
await this.enableSecureFilePreviewToggleFalse.click();
|
||||
}
|
||||
|
||||
async clickAllowPdfLinkNavigationToggleTrue() {
|
||||
await this.allowPdfLinkNavigationToggleTrue.click();
|
||||
}
|
||||
|
||||
async clickAllowPdfLinkNavigationToggleFalse() {
|
||||
await this.allowPdfLinkNavigationToggleFalse.click();
|
||||
}
|
||||
|
||||
async clickSaveButton() {
|
||||
await this.saveButton.click();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,10 @@ test('should be able to enable mobile security settings when licensed', async ({
|
||||
|
||||
const license = await adminClient.getClientLicenseOld();
|
||||
|
||||
test.skip(license.SkuShortName !== 'enterprise', 'Skipping test - server has no enterprise license');
|
||||
test.skip(
|
||||
license.SkuShortName !== 'enterprise' || license.short_sku_name !== 'advanced',
|
||||
'Skipping test - server has no enterprise or enterprise advanced license',
|
||||
);
|
||||
|
||||
if (!adminUser) {
|
||||
throw new Error('Failed to create admin user');
|
||||
@@ -96,6 +99,62 @@ test('should be able to enable mobile security settings when licensed', async ({
|
||||
expect(await systemConsolePage.mobileSecurity.enableBiometricAuthenticationToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.preventScreenCaptureToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.jailbreakProtectionToggleTrue.isChecked()).toBe(true);
|
||||
|
||||
if (license.SkuShortName === 'advanced') {
|
||||
// # Enable Secure File Preview
|
||||
await systemConsolePage.mobileSecurity.clickEnableSecureFilePreviewToggleTrue();
|
||||
|
||||
// * Verify all toggles are enabled
|
||||
expect(await systemConsolePage.mobileSecurity.enableBiometricAuthenticationToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.preventScreenCaptureToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.jailbreakProtectionToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.enableSecureFilePreviewToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.allowPdfLinkNavigationToggleTrue.isChecked()).toBe(false);
|
||||
|
||||
// # Save settings
|
||||
await systemConsolePage.mobileSecurity.clickSaveButton();
|
||||
// # Wait until the save button has settled
|
||||
await pw.waitUntil(async () => (await systemConsolePage.mobileSecurity.saveButton.textContent()) === 'Save');
|
||||
|
||||
// # Go to any other section and come back to Mobile Security
|
||||
await systemConsolePage.sidebar.goToItem('Users');
|
||||
await systemConsolePage.systemUsers.toBeVisible();
|
||||
await systemConsolePage.sidebar.goToItem('Mobile Security');
|
||||
|
||||
// * Verify all toggles are still enabled
|
||||
expect(await systemConsolePage.mobileSecurity.enableBiometricAuthenticationToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.preventScreenCaptureToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.jailbreakProtectionToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.enableSecureFilePreviewToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.allowPdfLinkNavigationToggleTrue.isChecked()).toBe(false);
|
||||
|
||||
// # Enable Allow PDF Link Navigation
|
||||
await systemConsolePage.mobileSecurity.clickAllowPdfLinkNavigationToggleTrue();
|
||||
|
||||
// * Verify all toggles are enabled
|
||||
expect(await systemConsolePage.mobileSecurity.enableBiometricAuthenticationToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.preventScreenCaptureToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.jailbreakProtectionToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.enableSecureFilePreviewToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.allowPdfLinkNavigationToggleTrue.isChecked()).toBe(true);
|
||||
|
||||
// # Save settings
|
||||
await systemConsolePage.mobileSecurity.clickSaveButton();
|
||||
// # Wait until the save button has settled
|
||||
await pw.waitUntil(async () => (await systemConsolePage.mobileSecurity.saveButton.textContent()) === 'Save');
|
||||
|
||||
// # Go to any other section and come back to Mobile Security
|
||||
await systemConsolePage.sidebar.goToItem('Users');
|
||||
await systemConsolePage.systemUsers.toBeVisible();
|
||||
await systemConsolePage.sidebar.goToItem('Mobile Security');
|
||||
|
||||
// * Verify all toggles are still enabled
|
||||
expect(await systemConsolePage.mobileSecurity.enableBiometricAuthenticationToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.preventScreenCaptureToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.jailbreakProtectionToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.enableSecureFilePreviewToggleTrue.isChecked()).toBe(true);
|
||||
expect(await systemConsolePage.mobileSecurity.allowPdfLinkNavigationToggleTrue.isChecked()).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
test('should show mobile security upsell when not licensed', async ({pw}) => {
|
||||
|
||||
Ссылка в новой задаче
Block a user