Skip to content

Commit

Permalink
Merge branch 'main' into #2704
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcostae authored Nov 3, 2023
2 parents 8c59065 + d14bb68 commit 273f9d8
Showing 2 changed files with 42 additions and 5 deletions.
18 changes: 16 additions & 2 deletions public/apps/configuration/panels/role-edit/role-edit.tsx
Original file line number Diff line number Diff line change
@@ -166,12 +166,19 @@ export function RoleEdit(props: RoleEditDeps) {

const clusterWisePermissionOptions = [
{
label: 'Permission groups',
label: 'Cluster permission groups',
options: actionGroups
.filter((actionGroup) => actionGroup[1].type === 'cluster')
.map((actionGroup) => actionGroup[0])
.map(stringToComboBoxOption),
},
{
label: 'Other permission groups',
options: actionGroups
.filter((actionGroup) => actionGroup[1].type === undefined)
.map((actionGroup) => actionGroup[0])
.map(stringToComboBoxOption),
},
{
label: 'Cluster permissions',
options: CLUSTER_PERMISSIONS.map(stringToComboBoxOption),
@@ -180,12 +187,19 @@ export function RoleEdit(props: RoleEditDeps) {

const indexWisePermissionOptions = [
{
label: 'Permission groups',
label: 'Index permission groups',
options: actionGroups
.filter((actionGroup) => actionGroup[1].type === 'index')
.map((actionGroup) => actionGroup[0])
.map(stringToComboBoxOption),
},
{
label: 'Other permission groups',
options: actionGroups
.filter((actionGroup) => actionGroup[1].type === undefined)
.map((actionGroup) => actionGroup[0])
.map(stringToComboBoxOption),
},
{
label: 'Index permissions',
options: INDEX_PERMISSIONS.map(stringToComboBoxOption),
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@
import React from 'react';
import { ClusterPermissionPanel } from '../cluster-permission-panel';
import { RoleEdit } from '../role-edit';
import { ActionGroupItem } from '../../../types';
import { fetchActionGroups } from '../../../utils/action-groups-utils';

import { render, waitFor } from '@testing-library/react';
@@ -67,6 +66,14 @@ describe('Role edit filtering', () => {
description: 'Manage pipelines',
static: true,
},
custom: {
reserved: false,
hidden: false,
allowed_actions: ['cluster:admin/ingest/pipeline/*'],
type: undefined,
description: 'Custom group',
static: true,
},
});

it('basic cluster permission panel rendering', async () => {
@@ -98,13 +105,21 @@ describe('Role edit filtering', () => {
// Cluster Permission Panel props is filtered to action groups with type cluster, and only the cluster permission constants
expect(props.optionUniverse).toEqual([
{
label: 'Permission groups',
label: 'Cluster permission groups',
options: [
{
label: 'cluster_manage_pipelines',
},
],
},
{
label: 'Other permission groups',
options: [
{
label: 'custom',
},
],
},
{
label: 'Cluster permissions',
options: CLUSTER_PERMISSIONS.map((x) => {
@@ -143,13 +158,21 @@ describe('Role edit filtering', () => {
// Index Permission Panel props is filtered to action groups with type index, and only the index permission constants
expect(props.optionUniverse).toEqual([
{
label: 'Permission groups',
label: 'Index permission groups',
options: [
{
label: 'data_access',
},
],
},
{
label: 'Other permission groups',
options: [
{
label: 'custom',
},
],
},
{
label: 'Index permissions',
options: INDEX_PERMISSIONS.map((x) => {

0 comments on commit 273f9d8

Please sign in to comment.