1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08: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 {UserDTO, UserRoles} from '../../../../common/entities/UserDTO';
import {Column, Entity, PrimaryGeneratedColumn} from 'typeorm'; import {Column, Entity, PrimaryGeneratedColumn, Unique} from 'typeorm';
@Entity() @Entity()
@Unique(['name'])
export class UserEntity implements UserDTO { export class UserEntity implements UserDTO {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()

View File

@ -27,6 +27,9 @@ export module UserDTO {
} }
for (let i = 0; i < permissions.length; i++) { for (let i = 0; i < permissions.length; i++) {
let permission = permissions[i]; let permission = permissions[i];
if (permissions[i] === separator + '*') {
return true;
}
if (permission[permission.length - 1] === '*') { if (permission[permission.length - 1] === '*') {
permission = permission.slice(0, -1); permission = permission.slice(0, -1);
if (path.startsWith(permission) && (!path[permission.length] || path[permission.length] === separator)) { if (path.startsWith(permission) && (!path[permission.length] || path[permission.length] === separator)) {