diff --git a/components/admin_console/system_roles/system_role/system_role.tsx b/components/admin_console/system_roles/system_role/system_role.tsx index 9a4629833d59..1d6a9945e256 100644 --- a/components/admin_console/system_roles/system_role/system_role.tsx +++ b/components/admin_console/system_roles/system_role/system_role.tsx @@ -6,6 +6,7 @@ import {FormattedMessage} from 'react-intl'; import {uniq, difference} from 'lodash'; import {Role} from 'mattermost-redux/types/roles'; +import {Client4} from 'mattermost-redux/client'; import {UserProfile} from 'mattermost-redux/types/users'; import {Dictionary} from 'mattermost-redux/types/utilities'; @@ -124,9 +125,11 @@ export default class SystemRole extends React.PureComponent { // Do not update permissions if sysadmin or if roles have not been updated (to prevent overrwiting roles with no permissions) if (role.name !== Constants.PERMISSIONS_SYSTEM_ADMIN && Object.keys(permissionsToUpdate).length > 0) { + const rolePermissionsWithAncillaryPermssions = await Client4.getAncillaryPermissions(updatedRolePermissions); + const newRole: Role = { ...role, - permissions: updatedRolePermissions, + permissions: rolePermissionsWithAncillaryPermssions, }; const result = await editRole(newRole); if (isError(result)) { diff --git a/packages/mattermost-redux/src/client/client4.ts b/packages/mattermost-redux/src/client/client4.ts index 0ee2ea33850b..05cacfd7d48b 100644 --- a/packages/mattermost-redux/src/client/client4.ts +++ b/packages/mattermost-redux/src/client/client4.ts @@ -422,6 +422,10 @@ export default class Client4 { return `${this.getBaseRoute()}/cloud`; } + getPermissionsRoute() { + return `${this.getBaseRoute()}/permissions`; + } + getUserThreadsRoute(userID: string, teamID: string): string { return `${this.getUserRoute(userID)}/teams/${teamID}/threads`; } @@ -3710,6 +3714,13 @@ export default class Client4 { ); } + getAncillaryPermissions = (subsectionPermissions: string[]) => { + return this.doFetch( + `${this.getPermissionsRoute()}/ancillary?subsection_permissions=${subsectionPermissions.join(',')}`, + {method: 'get'}, + ); + } + // Client Helpers doFetch = async (url: string, options: Options): Promise => {