[permissions] QA fixes (#13698)

In this PR

- Introduction of readableFields and updatableFields in
objectMetadataItem selector to ease filtering from a developer
experience perspective ( + to help developers think to do it). In
discussion @lucasbordeau @charlesBochet
- Remove non-updatable field from CSV import process (@etiennejouan)
- QA fix / Non-readable fields should not show on show page
- QA fix / It should not be offered to create a kanban view on a
non-readable field
- QA fix / It should not be offered to create view groups on a
non-readable field
- QA fix / Rating field should have a readonly mode

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Marie
2025-08-07 18:21:59 +02:00
committed by GitHub
parent 258f21a4be
commit ee19ee5119
120 changed files with 1211 additions and 943 deletions
@@ -1,7 +1,7 @@
import { Field, ObjectType } from '@nestjs/graphql';
import GraphQLJSON from 'graphql-type-json';
import { RestrictedFields } from 'twenty-shared/types';
import { RestrictedFieldsPermissions } from 'twenty-shared/types';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
@@ -25,5 +25,5 @@ export class ObjectPermissionDTO {
@Field(() => GraphQLJSON, {
nullable: true,
})
restrictedFields?: RestrictedFields;
restrictedFields?: RestrictedFieldsPermissions;
}
@@ -1,7 +1,7 @@
import { Test, TestingModule } from '@nestjs/testing';
import { getRepositoryToken } from '@nestjs/typeorm';
import { ObjectRecordsPermissionsByRoleId } from 'twenty-shared/types';
import { ObjectsPermissionsByRoleIdDeprecated } from 'twenty-shared/types';
import { In, Repository } from 'typeorm';
import {
@@ -53,7 +53,7 @@ describe('FieldPermissionService', () => {
isEditable: true,
} as RoleEntity;
const mockRolesPermissions: ObjectRecordsPermissionsByRoleId = {
const mockRolesPermissions: ObjectsPermissionsByRoleIdDeprecated = {
[testRoleId]: {
[testObjectMetadataId]: {
canRead: true,
@@ -1,7 +1,7 @@
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { ObjectRecordsPermissionsByRoleId } from 'twenty-shared/types';
import { ObjectsPermissionsByRoleIdDeprecated } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import { In, Repository } from 'typeorm';
@@ -176,7 +176,7 @@ export class FieldPermissionService {
}: {
fieldPermission: UpsertFieldPermissionsInput['fieldPermissions'][0];
objectMetadataMapsById: ObjectMetadataMaps['byId'];
rolesPermissions: ObjectRecordsPermissionsByRoleId;
rolesPermissions: ObjectsPermissionsByRoleIdDeprecated;
role: RoleEntity;
}) {
if (