mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
group name default group issue
This commit is contained in:
parent
4d348b06ba
commit
f1827722ab
3 changed files with 9 additions and 3 deletions
|
|
@ -102,6 +102,7 @@ export const DEFAULT_GROUP_PERMISSIONS_MIGRATIONS = {
|
|||
|
||||
export const ERROR_HANDLER = {
|
||||
GROUP_NOT_EXIST: "Group doesn't exist",
|
||||
RESERVED_KEYWORDS_FOR_GROUP_NAME: 'Group name cannot be same as reserved keywords',
|
||||
DEFAULT_GROUP_NAME: 'Name cannot be same as user default group',
|
||||
DEFAULT_GROUP_NAME_UPDATE: 'Not allowed to change default group name',
|
||||
DEFAULT_GROUP_NAME_DELETE: 'Not allowed to delete default group',
|
||||
|
|
|
|||
|
|
@ -135,7 +135,12 @@ export function getAllUserGroupsQuery(
|
|||
}
|
||||
|
||||
export function validateCreateGroupOperation(createGroupPermissionDto: CreateGroupPermissionDto) {
|
||||
if (createGroupPermissionDto.name in USER_ROLE) throw new BadRequestException(ERROR_HANDLER.DEFAULT_GROUP_NAME);
|
||||
const humanizeList = ['End-user', 'Builder', 'Admin'];
|
||||
if (humanizeList.includes(createGroupPermissionDto.name))
|
||||
throw new BadRequestException(ERROR_HANDLER.DEFAULT_GROUP_NAME);
|
||||
|
||||
if (Object.values(USER_ROLE).includes(createGroupPermissionDto.name as USER_ROLE))
|
||||
throw new BadRequestException(ERROR_HANDLER.RESERVED_KEYWORDS_FOR_GROUP_NAME);
|
||||
}
|
||||
|
||||
export function addableUsersToGroupQuery(
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
import { GranularPermissions } from 'src/entities/granular_permissions.entity';
|
||||
import { TOOLJET_RESOURCE } from 'src/constants/global.constant';
|
||||
import { getUserPermissionsQuery } from '@module/permissions/utility/permission-ability.utility';
|
||||
import { App } from 'src/entities/app.entity';
|
||||
import { AppBase } from 'src/entities/app_base.entity';
|
||||
|
||||
@Injectable()
|
||||
export class AbilityService {
|
||||
|
|
@ -88,7 +88,7 @@ export class AbilityService {
|
|||
});
|
||||
|
||||
await dbTransactionWrap(async (manager: EntityManager) => {
|
||||
const appsOwnedByUser = await manager.find(App, {
|
||||
const appsOwnedByUser = await manager.find(AppBase, {
|
||||
where: { userId: user.id, organizationId: user.organizationId },
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue