mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-18 18:18:23 -05:00
[MM-67530] Only show autotranslation permissions to licensed users (#35283)
Some checks are pending
API / build (push) Waiting to run
Server CI / Compute Go Version (push) Waiting to run
Server CI / Check mocks (push) Blocked by required conditions
Server CI / Check go mod tidy (push) Blocked by required conditions
Server CI / check-style (push) Blocked by required conditions
Server CI / Check serialization methods for hot structs (push) Blocked by required conditions
Server CI / Vet API (push) Blocked by required conditions
Server CI / Check migration files (push) Blocked by required conditions
Server CI / Generate email templates (push) Blocked by required conditions
Server CI / Check store layers (push) Blocked by required conditions
Server CI / Check mmctl docs (push) Blocked by required conditions
Server CI / Postgres with binary parameters (push) Blocked by required conditions
Server CI / Postgres (push) Blocked by required conditions
Server CI / Postgres (FIPS) (push) Blocked by required conditions
Server CI / Generate Test Coverage (push) Blocked by required conditions
Server CI / Run mmctl tests (push) Blocked by required conditions
Server CI / Run mmctl tests (FIPS) (push) Blocked by required conditions
Server CI / Build mattermost server app (push) Blocked by required conditions
Web App CI / check-lint (push) Waiting to run
Web App CI / check-i18n (push) Blocked by required conditions
Web App CI / check-types (push) Blocked by required conditions
Web App CI / test (platform) (push) Blocked by required conditions
Web App CI / test (mattermost-redux) (push) Blocked by required conditions
Web App CI / test (channels shard 1/4) (push) Blocked by required conditions
Web App CI / test (channels shard 2/4) (push) Blocked by required conditions
Web App CI / test (channels shard 3/4) (push) Blocked by required conditions
Web App CI / test (channels shard 4/4) (push) Blocked by required conditions
Web App CI / upload-coverage (push) Blocked by required conditions
Web App CI / build (push) Blocked by required conditions
Some checks are pending
API / build (push) Waiting to run
Server CI / Compute Go Version (push) Waiting to run
Server CI / Check mocks (push) Blocked by required conditions
Server CI / Check go mod tidy (push) Blocked by required conditions
Server CI / check-style (push) Blocked by required conditions
Server CI / Check serialization methods for hot structs (push) Blocked by required conditions
Server CI / Vet API (push) Blocked by required conditions
Server CI / Check migration files (push) Blocked by required conditions
Server CI / Generate email templates (push) Blocked by required conditions
Server CI / Check store layers (push) Blocked by required conditions
Server CI / Check mmctl docs (push) Blocked by required conditions
Server CI / Postgres with binary parameters (push) Blocked by required conditions
Server CI / Postgres (push) Blocked by required conditions
Server CI / Postgres (FIPS) (push) Blocked by required conditions
Server CI / Generate Test Coverage (push) Blocked by required conditions
Server CI / Run mmctl tests (push) Blocked by required conditions
Server CI / Run mmctl tests (FIPS) (push) Blocked by required conditions
Server CI / Build mattermost server app (push) Blocked by required conditions
Web App CI / check-lint (push) Waiting to run
Web App CI / check-i18n (push) Blocked by required conditions
Web App CI / check-types (push) Blocked by required conditions
Web App CI / test (platform) (push) Blocked by required conditions
Web App CI / test (mattermost-redux) (push) Blocked by required conditions
Web App CI / test (channels shard 1/4) (push) Blocked by required conditions
Web App CI / test (channels shard 2/4) (push) Blocked by required conditions
Web App CI / test (channels shard 3/4) (push) Blocked by required conditions
Web App CI / test (channels shard 4/4) (push) Blocked by required conditions
Web App CI / upload-coverage (push) Blocked by required conditions
Web App CI / build (push) Blocked by required conditions
* [MM-67530] Only show autotranslation permissions to licensed users * Fix and add more tests * Update webapp/channels/src/components/admin_console/permission_schemes_settings/permissions_tree/permissions_tree.test.tsx Co-authored-by: Doug Lauder <wiggin77@warpmail.net> * Update webapp/channels/src/components/admin_console/permission_schemes_settings/permissions_tree/permissions_tree.test.tsx Co-authored-by: Doug Lauder <wiggin77@warpmail.net> --------- Co-authored-by: Doug Lauder <wiggin77@warpmail.net> Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
dde324873f
commit
cca467ab2f
4 changed files with 52 additions and 16 deletions
|
|
@ -64,7 +64,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_public_channel",
|
||||
"manage_public_channel_properties",
|
||||
"manage_public_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_public_channel_members_and_read_groups",
|
||||
|
|
@ -82,7 +81,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_private_channel",
|
||||
"manage_private_channel_properties",
|
||||
"manage_private_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_private_channel_members_and_read_groups",
|
||||
|
|
@ -260,7 +258,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_public_channel",
|
||||
"manage_public_channel_properties",
|
||||
"manage_public_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_public_channel_members_and_read_groups",
|
||||
|
|
@ -278,7 +275,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_private_channel",
|
||||
"manage_private_channel_properties",
|
||||
"manage_private_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_private_channel_members_and_read_groups",
|
||||
|
|
@ -483,7 +479,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_public_channel",
|
||||
"manage_public_channel_properties",
|
||||
"manage_public_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_public_channel_members_and_read_groups",
|
||||
|
|
@ -501,7 +496,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_private_channel",
|
||||
"manage_private_channel_properties",
|
||||
"manage_private_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_private_channel_members_and_read_groups",
|
||||
|
|
@ -695,7 +689,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_public_channel",
|
||||
"manage_public_channel_properties",
|
||||
"manage_public_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_public_channel_members_and_read_groups",
|
||||
|
|
@ -713,7 +706,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_private_channel",
|
||||
"manage_private_channel_properties",
|
||||
"manage_private_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_private_channel_members_and_read_groups",
|
||||
|
|
@ -918,7 +910,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_public_channel",
|
||||
"manage_public_channel_properties",
|
||||
"manage_public_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_public_channel_members_and_read_groups",
|
||||
|
|
@ -936,7 +927,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_private_channel",
|
||||
"manage_private_channel_properties",
|
||||
"manage_private_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_private_channel_members_and_read_groups",
|
||||
|
|
@ -1141,7 +1131,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_public_channel",
|
||||
"manage_public_channel_properties",
|
||||
"manage_public_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_public_channel_members_and_read_groups",
|
||||
|
|
@ -1159,7 +1148,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_private_channel",
|
||||
"manage_private_channel_properties",
|
||||
"manage_private_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_private_channel_members_and_read_groups",
|
||||
|
|
@ -1371,7 +1359,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_public_channel",
|
||||
"manage_public_channel_properties",
|
||||
"manage_public_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_public_channel_members_and_read_groups",
|
||||
|
|
@ -1389,7 +1376,6 @@ exports[`components/admin_console/permission_schemes_settings/permission_tree sh
|
|||
"permissions": Array [
|
||||
"create_private_channel",
|
||||
"manage_private_channel_properties",
|
||||
"manage_private_channel_auto_translation",
|
||||
Object {
|
||||
"combined": true,
|
||||
"id": "manage_private_channel_members_and_read_groups",
|
||||
|
|
|
|||
|
|
@ -206,4 +206,52 @@ describe('components/admin_console/permission_schemes_settings/permission_tree',
|
|||
}));
|
||||
});
|
||||
});
|
||||
|
||||
describe('should show auto translation permissions', () => {
|
||||
describe('for non-enterprise-advanced license', () => {
|
||||
['', LicenseSkus.E10, LicenseSkus.Starter, LicenseSkus.Professional, LicenseSkus.Enterprise, LicenseSkus.E20].forEach((licenseSku) => test(licenseSku, () => {
|
||||
const props = {
|
||||
...defaultProps,
|
||||
license: {
|
||||
isLicensed: licenseSku === '' ? 'false' : 'true',
|
||||
SkuShortName: licenseSku,
|
||||
},
|
||||
};
|
||||
|
||||
const wrapper = shallow(
|
||||
<PermissionsTree
|
||||
{...props}
|
||||
/>,
|
||||
);
|
||||
const groups = wrapper.find(PermissionGroup).first().prop('permissions') as Array<Group | Permission>;
|
||||
expect(groups[1].permissions).not.toContain('manage_public_channel_auto_translation');
|
||||
expect(groups[1].permissions).not.toContain('manage_private_channel_auto_translation');
|
||||
expect(groups[2].permissions).not.toContain('manage_public_channel_auto_translation');
|
||||
expect(groups[2].permissions).not.toContain('manage_private_channel_auto_translation');
|
||||
}));
|
||||
});
|
||||
|
||||
describe('for enterprise-advanced license', () => {
|
||||
[LicenseSkus.Entry, LicenseSkus.EnterpriseAdvanced].forEach((licenseSku) => test(licenseSku, () => {
|
||||
const props = {
|
||||
...defaultProps,
|
||||
license: {
|
||||
isLicensed: 'true',
|
||||
SkuShortName: licenseSku,
|
||||
},
|
||||
};
|
||||
|
||||
const wrapper = shallow(
|
||||
<PermissionsTree
|
||||
{...props}
|
||||
/>,
|
||||
);
|
||||
const groups = wrapper.find(PermissionGroup).first().prop('permissions') as Array<Group | Permission>;
|
||||
expect(groups[1].permissions).toContain('manage_public_channel_auto_translation');
|
||||
expect(groups[1].permissions).not.toContain('manage_private_channel_auto_translation');
|
||||
expect(groups[2].permissions).not.toContain('manage_public_channel_auto_translation');
|
||||
expect(groups[2].permissions).toContain('manage_private_channel_auto_translation');
|
||||
}));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ export default class PermissionsTree extends React.PureComponent<Props, State> {
|
|||
permissions: [
|
||||
Permissions.CREATE_PUBLIC_CHANNEL,
|
||||
Permissions.MANAGE_PUBLIC_CHANNEL_PROPERTIES,
|
||||
Permissions.MANAGE_PUBLIC_CHANNEL_AUTO_TRANSLATION,
|
||||
{
|
||||
id: 'manage_public_channel_members_and_read_groups',
|
||||
combined: true,
|
||||
|
|
@ -105,7 +104,6 @@ export default class PermissionsTree extends React.PureComponent<Props, State> {
|
|||
permissions: [
|
||||
Permissions.CREATE_PRIVATE_CHANNEL,
|
||||
Permissions.MANAGE_PRIVATE_CHANNEL_PROPERTIES,
|
||||
Permissions.MANAGE_PRIVATE_CHANNEL_AUTO_TRANSLATION,
|
||||
{
|
||||
id: 'manage_private_channel_members_and_read_groups',
|
||||
combined: true,
|
||||
|
|
@ -322,7 +320,9 @@ export default class PermissionsTree extends React.PureComponent<Props, State> {
|
|||
|
||||
if (isMinimumEnterpriseAdvancedLicense(license)) {
|
||||
publicChannelsGroup.permissions.push(Permissions.MANAGE_PUBLIC_CHANNEL_BANNER);
|
||||
publicChannelsGroup.permissions.push(Permissions.MANAGE_PUBLIC_CHANNEL_AUTO_TRANSLATION);
|
||||
privateChannelsGroup.permissions.push(Permissions.MANAGE_PRIVATE_CHANNEL_BANNER);
|
||||
privateChannelsGroup.permissions.push(Permissions.MANAGE_PRIVATE_CHANNEL_AUTO_TRANSLATION);
|
||||
privateChannelsGroup.permissions.push(Permissions.MANAGE_CHANNEL_ACCESS_RULES);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1308,6 +1308,8 @@ export const DefaultRolePermissions = {
|
|||
Permissions.ORDER_BOOKMARK_PRIVATE_CHANNEL,
|
||||
Permissions.MANAGE_PUBLIC_CHANNEL_BANNER,
|
||||
Permissions.MANAGE_PRIVATE_CHANNEL_BANNER,
|
||||
Permissions.MANAGE_PUBLIC_CHANNEL_AUTO_TRANSLATION,
|
||||
Permissions.MANAGE_PRIVATE_CHANNEL_AUTO_TRANSLATION,
|
||||
Permissions.MANAGE_CHANNEL_ACCESS_RULES,
|
||||
],
|
||||
team_admin: [
|
||||
|
|
|
|||
Loading…
Reference in a new issue