Skip to content

Commit

Permalink
Merge pull request #3123 from uselagoon/ODFE_cluster_perms
Browse files Browse the repository at this point in the history
Set OpenDistro cluster permissions correcly and configure OpenSearch backend_roles
  • Loading branch information
tobybellwood authored May 1, 2022
2 parents 8251fbf + a51fa39 commit 33540c3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions services/api/src/resources/group/opendistroSecurity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ export const OpendistroSecurityOperations = (
const groupProjectPermissions = {
body: {
cluster_permissions: [
{
allowed_actions: ['cluster:admin/opendistro/reports/menu/download']
}
'cluster:admin/opendistro/reports/menu/download'
],
index_permissions: [
{
Expand Down Expand Up @@ -96,6 +94,14 @@ export const OpendistroSecurityOperations = (
logger.debug(`${groupName}: Created Tenant "${tenantName}"`);
} catch (err) {
logger.error(`Opendistro-Security create tenant error: ${err}`);
};

try {
// Create a new RoleMapping for this Group
await opendistroSecurityClient.put(`rolesmapping/${tenantName}`, { body: { backend_roles: [`${tenantName}`] } });
logger.debug(`${groupName}: Created RoleMapping "${tenantName}"`);
} catch (err) {
logger.error(`Opendistro-Security create rolemapping error: ${err}`);
}
}

Expand Down

0 comments on commit 33540c3

Please sign in to comment.