Skip to content

Commit

Permalink
Merge pull request #377 from alkem-io/entitlements
Browse files Browse the repository at this point in the history
Entitlement related adjustments
  • Loading branch information
Comoque1 authored Nov 15, 2024
2 parents 4e4bbea + eda7fcc commit aa1b3cf
Show file tree
Hide file tree
Showing 20 changed files with 431 additions and 172 deletions.
2 changes: 1 addition & 1 deletion graphql/fragments/features/featureFlagRules.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fragment featureFlagRules on LicensePolicyCredentialRule {
name
grantedPrivileges
grantedEntitlements
}
2 changes: 1 addition & 1 deletion graphql/mutations/license/createLicensePlan.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mutation CreateLicensePlan($LicensePlan: CreateLicensePlanOnLicensingInput!) {
mutation CreateLicensePlan($LicensePlan: CreateLicensePlanOnLicensingFrameworkInput!) {
createLicensePlan(planData: $LicensePlan) {
...LicensePlanData
}
Expand Down
4 changes: 2 additions & 2 deletions graphql/queries/platform/getPlatformLicensePlans.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
query GetPlatgformLicensePlans {
query GetPlatformLicensePlans {
platform {
licensing {
licensingFramework {
plans {
...LicensePlanData
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe('Limits on account resources creation', () => {
users.globalAdmin.accountId,
TestUser.GLOBAL_ADMIN
);
console.log('createSpace', createSpace.error);
spaceId = createSpace.data?.createSpace.id ?? '';

const spaceData = await getSpaceData(spaceId);
Expand All @@ -73,7 +72,6 @@ describe('Limits on account resources creation', () => {
users.betaTester.accountId,
TestUser.BETA_TESTER
);
console.log('createSpace', createSpace.error);
spaceId = createSpace.data?.createSpace.id ?? '';

const spaceData = await getSpaceData(spaceId);
Expand Down Expand Up @@ -104,7 +102,6 @@ describe('Limits on account resources creation', () => {
users.opportunityAdmin.accountId,
TestUser.CHALLENGE_ADMIN
);
console.log('createSpace', createSpace.error);
spaceId = createSpace.data?.createSpace.id ?? '';
spaceId = spaceIdn;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ describe('Communities', () => {
entitiesId.spaceId,
TestUser.NON_HUB_MEMBER
);
console.log(spaceDataReaderNotMemberIn.error);
const spaceDataReaderNotMember =
spaceDataReaderNotMemberIn?.data?.space?.community?.communication
?.updates.messages ?? [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,11 @@ describe('Organization Owner', () => {
users.spaceMember.id,
organizationId
);
console.log('resOne', resOne.error);

const resTwo = await assignUserAsOrganizationOwner(
users.spaceMember.id,
organizationIdTwo
);
console.log('resTwo', resTwo.error);

// Assert
expect(
Expand All @@ -84,10 +82,7 @@ describe('Organization Owner', () => {

test('should remove user owner from organization', async () => {
// Arrange
await assignUserAsOrganizationOwner(
users.spaceMember.id,
organizationId
);
await assignUserAsOrganizationOwner(users.spaceMember.id, organizationId);

await assignUserAsOrganizationOwner(
users.nonSpaceMember.id,
Expand All @@ -108,10 +103,7 @@ describe('Organization Owner', () => {

test('should not remove the only owner of an organization', async () => {
// Arrange
await assignUserAsOrganizationOwner(
users.spaceMember.id,
organizationId
);
await assignUserAsOrganizationOwner(users.spaceMember.id, organizationId);

// Act
const res = await removeUserAsOrganizationOwner(
Expand Down Expand Up @@ -140,10 +132,7 @@ describe('Organization Owner', () => {

test('should throw error for assigning same organization owner twice', async () => {
// Arrange
await assignUserAsOrganizationOwner(
users.spaceMember.id,
organizationId
);
await assignUserAsOrganizationOwner(users.spaceMember.id, organizationId);

// Act
const res = await assignUserAsOrganizationOwner(
Expand Down
18 changes: 3 additions & 15 deletions test/functional-api/journey/challenge/flows-challenge.it-spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import {
createSubspace,
getSubspaceData,
} from './challenge.request.params';
import { createSubspace, getSubspaceData } from './challenge.request.params';
import '@test/utils/array.matcher';
import { deleteOrganization } from '@test/functional-api/contributor-management/organization/organization.request.params';
import {
deleteSpace,
updateSpaceContext,
} from '../space/space.request.params';
import { deleteSpace, updateSpaceContext } from '../space/space.request.params';
import { entitiesId } from '@test/types/entities-helper';
// import { uniqueId } from '@test/utils/mutations/create-mutation';
import { createOrgAndSpace } from '@test/utils/data-setup/entities';
Expand All @@ -25,12 +19,7 @@ const spaceName = 'flowch-sp-name' + uniqueId;
const spaceNameId = 'flowch-sp-nameid' + uniqueId;

beforeAll(async () => {
await createOrgAndSpace(
organizationName,
hostNameId,
spaceName,
spaceNameId
);
await createOrgAndSpace(organizationName, hostNameId, spaceName, spaceNameId);
});

afterAll(async () => {
Expand Down Expand Up @@ -61,7 +50,6 @@ describe('Flows challenge', () => {
entitiesId.spaceId,
challengeId
);
console.log(responseGroupQuery.data?.space.subspace.community);

// Assert
expect(responseGroupQuery.status).toBe(200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,7 @@ describe('Update space platform settings', () => {
`(
'User: "$user", should have private Space privileges: "$spaceMyPrivileges"',
async ({ user, spaceMyPrivileges }) => {
const request = await getPrivateSpaceData(
entitiesId.spaceId,
user
);
const request = await getPrivateSpaceData(entitiesId.spaceId, user);
const result = request?.data?.space;

// Assert
Expand Down Expand Up @@ -171,10 +168,7 @@ describe('Update space platform settings', () => {
`(
'User: "$user", should have private Space privileges: "$spaceMyPrivileges"',
async ({ user, spaceMyPrivileges }) => {
const request = await getPrivateSpaceData(
entitiesId.spaceId,
user
);
const request = await getPrivateSpaceData(entitiesId.spaceId, user);
const result = request?.data?.space;

// Assert
Expand Down Expand Up @@ -246,7 +240,6 @@ describe('Update space platform settings', () => {
entitiesId.spaceId,
user
);
console.log('spaceDataAfterArchive', spaceDataAfterArchive);
const allSpaces = spaceDataAfterArchive?.data?.spaces;
const data = allSpaces?.filter((obj: { nameID: string }) => {
return obj.nameID.includes(spaceNameId);
Expand Down Expand Up @@ -311,10 +304,7 @@ describe('Update space platform settings', () => {
email,
SpaceVisibility.Archived
);
console.log(
'getUserRoleSpaceDataAfterArchive',
getUserRoleSpaceDataAfterArchive.error
);

const afterVisibilityChangeAllSpaces =
getUserRoleSpaceDataAfterArchive?.data?.rolesUser.spaces;
const dataAfterVisibilityChange = afterVisibilityChangeAllSpaces?.filter(
Expand All @@ -328,16 +318,10 @@ describe('Update space platform settings', () => {
user
);

console.log(
'spaceDataAfterArchive',
spaceDataAfterArchive.error?.errors
);
const allSpaces = spaceDataAfterArchive?.data?.spaces;
console.log('allSpaces', allSpaces);
const data = allSpaces?.filter((obj: { nameID: string }) => {
return obj.nameID.includes(spaceNameId);
});
console.log(data);
// Assert
//expect(dataBeforeVisibilityChange).toEqual(dataAfterVisibilityChange);
expect(data?.[0].visibility).toEqual(SpaceVisibility.Archived);
Expand Down
4 changes: 2 additions & 2 deletions test/functional-api/license/license.params.request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const getLicensePlans = async (
) => {
const graphqlClient = getGraphqlClient();
const callback = (authToken: string | undefined) =>
graphqlClient.GetPlatgformLicensePlans(
graphqlClient.GetPlatformLicensePlans(
{},
{
authorization: `Bearer ${authToken}`,
Expand All @@ -19,7 +19,7 @@ export const getLicensePlans = async (

export const getVCLicensePlan = async (licenseCredential: string) => {
const response = await getLicensePlans();
const allLicensePlans = response.data?.platform.licensing.plans ?? [];
const allLicensePlans = response.data?.platform.licensingFramework.plans ?? [];
const filteredLicensePlan = allLicensePlans.filter(
plan =>
plan.licenseCredential.includes(licenseCredential) ||
Expand Down
1 change: 0 additions & 1 deletion test/functional-api/roleset/user/user2.it-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ beforeAll(async () => {

await createOrgAndSpace(organizationName, hostNameId, spaceName, spaceNameId);
await createChallengeForOrgSpace(challengeName);
console.log(entitiesId.challenge.nameId);
await createOpportunityForChallenge(opportunityName);

await assignRoleToUser(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ beforeAll(async () => {
allowMembersToCreateSubspaces: false,
},
});
console.log(a.error);
});
afterAll(async () => {
await deleteSpace(entitiesId.challenge.id);
Expand Down
2 changes: 0 additions & 2 deletions test/functional-api/storage/uploads.it-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@ describe('Upload visual to innovation space', () => {
//const spaceAccountId = spaceData?.account.id ?? '';

const innovationHubData = await createInnovationHub(orgAccountId);
console.log('innovationHubData', innovationHubData.error?.errors);
console.log('innovationHubData', innovationHubData.error?.errors);
const innovationHubInfo = innovationHubData?.data?.createInnovationHub;
innovationHubVisualId = innovationHubInfo?.profile.visuals[0].id ?? '';
innovationHubId = innovationHubInfo?.id ?? '';
Expand Down
Loading

0 comments on commit aa1b3cf

Please sign in to comment.