2023-09-05 17:34:50 -04:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2024-05-31 11:29:24 -07:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-09-05 17:34:50 -04:00
|
|
|
*/
|
|
|
|
|
|
2025-01-06 11:40:32 -05:00
|
|
|
import { test } from '../../global-setup.js';
|
2024-08-06 13:15:00 -04:00
|
|
|
|
2024-12-17 10:17:32 -05:00
|
|
|
import * as boundaryCli from '../../helpers/boundary-cli';
|
2024-11-12 11:21:37 -05:00
|
|
|
import { GroupsPage } from '../pages/groups.js';
|
|
|
|
|
import { OrgsPage } from '../pages/orgs.js';
|
|
|
|
|
import { RolesPage } from '../pages/roles.js';
|
2023-09-05 17:34:50 -04:00
|
|
|
|
|
|
|
|
test.beforeAll(async () => {
|
2024-12-17 10:17:32 -05:00
|
|
|
await boundaryCli.checkBoundaryCli();
|
2023-09-05 17:34:50 -04:00
|
|
|
});
|
|
|
|
|
|
2025-02-12 17:24:51 -05:00
|
|
|
test(
|
|
|
|
|
'Verify a new role can be created and associated with a group',
|
|
|
|
|
{ tag: ['@ce', '@ent', '@aws', '@docker'] },
|
|
|
|
|
async ({
|
|
|
|
|
page,
|
|
|
|
|
baseURL,
|
|
|
|
|
adminAuthMethodId,
|
|
|
|
|
adminLoginName,
|
|
|
|
|
adminPassword,
|
|
|
|
|
}) => {
|
|
|
|
|
await page.goto('/');
|
|
|
|
|
let orgName;
|
|
|
|
|
try {
|
|
|
|
|
const orgsPage = new OrgsPage(page);
|
|
|
|
|
orgName = await orgsPage.createOrg();
|
|
|
|
|
const groupsPage = new GroupsPage(page);
|
|
|
|
|
const groupName = await groupsPage.createGroup();
|
|
|
|
|
await groupsPage.addMemberToGroup('admin');
|
|
|
|
|
const rolesPage = new RolesPage(page);
|
|
|
|
|
await rolesPage.createRole();
|
|
|
|
|
await rolesPage.addPrincipalToRole(groupName);
|
|
|
|
|
await rolesPage.addGrantsToRole('ids=*;type=*;actions=read,list');
|
|
|
|
|
} finally {
|
|
|
|
|
await boundaryCli.authenticateBoundary(
|
|
|
|
|
baseURL,
|
|
|
|
|
adminAuthMethodId,
|
|
|
|
|
adminLoginName,
|
|
|
|
|
adminPassword,
|
|
|
|
|
);
|
|
|
|
|
const orgId = await boundaryCli.getOrgIdFromName(orgName);
|
|
|
|
|
if (orgId) {
|
|
|
|
|
await boundaryCli.deleteScope(orgId);
|
|
|
|
|
}
|
2024-06-07 13:09:24 -04:00
|
|
|
}
|
2025-02-12 17:24:51 -05:00
|
|
|
},
|
|
|
|
|
);
|