[permissions - seeds] Give tim@apple.dev restricted rights (#12768)
Let's introduce an object-limited role for Tim, to test and/or spot incompatibilities with restricted permissions in the future. Our main user tim@apple.dev is now assigned a role that has all settings permissions, and all object permissions except for update on Pets (to test read-only view) and read on Rockets. Since we still need an admin user for each workspace we are introducing a new member, Jane, who has the admin role --------- Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
@ -88,7 +88,7 @@ describe('roles permissions', () => {
|
||||
|
||||
expect(resp.status).toBe(200);
|
||||
expect(resp.body.errors).toBeUndefined();
|
||||
expect(resp.body.data.getRoles).toHaveLength(3);
|
||||
expect(resp.body.data.getRoles).toHaveLength(4);
|
||||
expect(resp.body.data.getRoles).toEqual(
|
||||
expect.arrayContaining([
|
||||
{
|
||||
@ -107,10 +107,10 @@ describe('roles permissions', () => {
|
||||
label: 'Admin',
|
||||
workspaceMembers: [
|
||||
{
|
||||
id: '20202020-0687-4c41-b707-ed1bfca972a7',
|
||||
id: '20202020-463f-435b-828c-107e007a2711',
|
||||
name: {
|
||||
firstName: 'Tim',
|
||||
lastName: 'Apple',
|
||||
firstName: 'Jane',
|
||||
lastName: 'Austen',
|
||||
},
|
||||
},
|
||||
],
|
||||
@ -127,6 +127,18 @@ describe('roles permissions', () => {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Object-restricted',
|
||||
workspaceMembers: [
|
||||
{
|
||||
id: '20202020-0687-4c41-b707-ed1bfca972a7',
|
||||
name: {
|
||||
firstName: 'Tim',
|
||||
lastName: 'Apple',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]),
|
||||
);
|
||||
});
|
||||
@ -171,7 +183,7 @@ describe('roles permissions', () => {
|
||||
const query = {
|
||||
query: `
|
||||
mutation UpdateWorkspaceMemberRole {
|
||||
updateWorkspaceMemberRole(workspaceMemberId: "${WORKSPACE_MEMBER_DATA_SEED_IDS.TIM}", roleId: "test-role-id") {
|
||||
updateWorkspaceMemberRole(workspaceMemberId: "${WORKSPACE_MEMBER_DATA_SEED_IDS.JANE}", roleId: "test-role-id") {
|
||||
id
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
import { TEST_COMPANY_1_ID } from 'test/integration/constants/test-company-ids.constants';
|
||||
import {
|
||||
TEST_PERSON_1_ID,
|
||||
TEST_PERSON_2_ID,
|
||||
} from 'test/integration/constants/test-person-ids.constants';
|
||||
import { TEST_PRIMARY_LINK_URL } from 'test/integration/constants/test-primary-link-url.constant';
|
||||
import { makeRestAPIRequest } from 'test/integration/rest/utils/make-rest-api-request.util';
|
||||
import { deleteAllRecords } from 'test/integration/utils/delete-all-records';
|
||||
import { TEST_COMPANY_1_ID } from 'test/integration/constants/test-company-ids.constants';
|
||||
import { TEST_PRIMARY_LINK_URL } from 'test/integration/constants/test-primary-link-url.constant';
|
||||
import { TIM_ACCOUNT_ID } from 'test/integration/graphql/integration.constants';
|
||||
|
||||
import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type';
|
||||
import { WORKSPACE_MEMBER_DATA_SEED_IDS } from 'src/engine/workspace-manager/dev-seeder/data/constants/workspace-member-data-seeds.constant';
|
||||
|
||||
describe('Core REST API Create Many endpoint', () => {
|
||||
beforeEach(async () => {
|
||||
@ -112,12 +112,12 @@ describe('Core REST API Create Many endpoint', () => {
|
||||
|
||||
expect(createdPeople[0].createdBy.source).toBe(FieldActorSource.MANUAL);
|
||||
expect(createdPeople[0].createdBy.workspaceMemberId).toBe(
|
||||
TIM_ACCOUNT_ID,
|
||||
WORKSPACE_MEMBER_DATA_SEED_IDS.JANE,
|
||||
);
|
||||
|
||||
expect(createdPeople[1].createdBy.source).toBe(FieldActorSource.MANUAL);
|
||||
expect(createdPeople[1].createdBy.workspaceMemberId).toBe(
|
||||
TIM_ACCOUNT_ID,
|
||||
WORKSPACE_MEMBER_DATA_SEED_IDS.JANE,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@ -4,12 +4,12 @@ import {
|
||||
TEST_PRIMARY_LINK_URL,
|
||||
TEST_PRIMARY_LINK_URL_WIITHOUT_TRAILING_SLASH,
|
||||
} from 'test/integration/constants/test-primary-link-url.constant';
|
||||
import { TIM_ACCOUNT_ID } from 'test/integration/graphql/integration.constants';
|
||||
import { makeRestAPIRequest } from 'test/integration/rest/utils/make-rest-api-request.util';
|
||||
import { deleteAllRecords } from 'test/integration/utils/delete-all-records';
|
||||
import { generateRecordName } from 'test/integration/utils/generate-record-name';
|
||||
|
||||
import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type';
|
||||
import { WORKSPACE_MEMBER_DATA_SEED_IDS } from 'src/engine/workspace-manager/dev-seeder/data/constants/workspace-member-data-seeds.constant';
|
||||
|
||||
describe('Core REST API Create One endpoint', () => {
|
||||
beforeEach(async () => {
|
||||
@ -94,7 +94,9 @@ describe('Core REST API Create One endpoint', () => {
|
||||
const createdPerson = res.body.data.createPerson;
|
||||
|
||||
expect(createdPerson.createdBy.source).toBe(FieldActorSource.MANUAL);
|
||||
expect(createdPerson.createdBy.workspaceMemberId).toBe(TIM_ACCOUNT_ID);
|
||||
expect(createdPerson.createdBy.workspaceMemberId).toBe(
|
||||
WORKSPACE_MEMBER_DATA_SEED_IDS.JANE,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user