From f99e13f3fc2bcf1d63ec2077001db4bc9f1207a1 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Sat, 23 Feb 2019 00:12:59 +0100 Subject: [PATCH] test fix --- backend/model/sql/enitites/UserEntity.ts | 3 ++- common/entities/UserDTO.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/model/sql/enitites/UserEntity.ts b/backend/model/sql/enitites/UserEntity.ts index 99c603c4..aeacb7ee 100644 --- a/backend/model/sql/enitites/UserEntity.ts +++ b/backend/model/sql/enitites/UserEntity.ts @@ -1,7 +1,8 @@ import {UserDTO, UserRoles} from '../../../../common/entities/UserDTO'; -import {Column, Entity, PrimaryGeneratedColumn} from 'typeorm'; +import {Column, Entity, PrimaryGeneratedColumn, Unique} from 'typeorm'; @Entity() +@Unique(['name']) export class UserEntity implements UserDTO { @PrimaryGeneratedColumn() diff --git a/common/entities/UserDTO.ts b/common/entities/UserDTO.ts index 549f86dc..9443d3eb 100644 --- a/common/entities/UserDTO.ts +++ b/common/entities/UserDTO.ts @@ -27,6 +27,9 @@ export module UserDTO { } for (let i = 0; i < permissions.length; i++) { let permission = permissions[i]; + if (permissions[i] === separator + '*') { + return true; + } if (permission[permission.length - 1] === '*') { permission = permission.slice(0, -1); if (path.startsWith(permission) && (!path[permission.length] || path[permission.length] === separator)) {