1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-11-28 08:58:49 +02:00
This commit is contained in:
Patrik J. Braun 2019-02-23 00:12:59 +01:00
parent 4891eed7b3
commit f99e13f3fc
2 changed files with 5 additions and 1 deletions

View File

@ -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()

View File

@ -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)) {