Merge branch 'dev' into feature/105-addresses
# Conflicts: # src/errors/AddressErrors.ts # src/models/actions/create/CreateAddress.ts # src/models/actions/create/CreateDonor.ts # src/models/actions/create/CreateGroupContact.ts # src/models/actions/create/CreateParticipant.ts # src/models/actions/create/CreateRunner.ts # src/models/actions/create/CreateRunnerOrganisation.ts # src/models/actions/update/UpdateDonor.ts # src/models/actions/update/UpdateRunner.ts # src/models/actions/update/UpdateRunnerOrganisation.ts # src/models/entities/Address.ts # src/models/entities/IAddressUser.ts # src/models/entities/RunnerOrganisation.ts # src/models/responses/ResponseParticipant.ts # src/tests/donors/donor_add.spec.ts # src/tests/donors/donor_update.spec.ts # src/tests/runnerOrgs/org_add.spec.ts # src/tests/runnerOrgs/org_delete.spec.ts # src/tests/runnerOrgs/org_update.spec.ts # src/tests/runnerTeams/team_update.spec.ts # src/tests/runners/runner_update.spec.ts
This commit is contained in:
@@ -138,8 +138,10 @@ export class User extends Principal {
|
||||
|
||||
if (!this.groups) { return returnPermissions; }
|
||||
for (let group of this.groups) {
|
||||
for (let permission of group.permissions) {
|
||||
returnPermissions.push(permission);
|
||||
if (group.permissions) {
|
||||
for (let permission of group.permissions) {
|
||||
returnPermissions.push(permission);
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnPermissions;
|
||||
@@ -159,8 +161,10 @@ export class User extends Principal {
|
||||
|
||||
if (!this.groups) { return returnPermissions; }
|
||||
for (let group of this.groups) {
|
||||
for (let permission of group.permissions) {
|
||||
returnPermissions.push(permission.toString());
|
||||
if (group.permissions) {
|
||||
for (let permission of group.permissions) {
|
||||
returnPermissions.push(permission.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return Array.from(new Set(returnPermissions));
|
||||
|
||||
@@ -1,39 +1,40 @@
|
||||
import {
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString
|
||||
} from "class-validator";
|
||||
import { ChildEntity, Column } from "typeorm";
|
||||
import { ResponseUserGroup } from '../responses/ResponseUserGroup';
|
||||
import { Principal } from './Principal';
|
||||
|
||||
/**
|
||||
* Defines the UserGroup entity.
|
||||
* This entity describes a group of users with a set of permissions.
|
||||
*/
|
||||
@ChildEntity()
|
||||
export class UserGroup extends Principal {
|
||||
|
||||
/**
|
||||
* The group's name
|
||||
*/
|
||||
@Column()
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The group's description
|
||||
*/
|
||||
@Column({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* Turns this entity into it's response class.
|
||||
*/
|
||||
public toResponse(): ResponseUserGroup {
|
||||
return new ResponseUserGroup(this);
|
||||
}
|
||||
import {
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString
|
||||
} from "class-validator";
|
||||
import { ChildEntity, Column } from "typeorm";
|
||||
import { ResponsePrincipal } from '../responses/ResponsePrincipal';
|
||||
import { ResponseUserGroup } from '../responses/ResponseUserGroup';
|
||||
import { Principal } from './Principal';
|
||||
|
||||
/**
|
||||
* Defines the UserGroup entity.
|
||||
* This entity describes a group of users with a set of permissions.
|
||||
*/
|
||||
@ChildEntity()
|
||||
export class UserGroup extends Principal {
|
||||
|
||||
/**
|
||||
* The group's name
|
||||
*/
|
||||
@Column()
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The group's description
|
||||
*/
|
||||
@Column({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* Turns this entity into it's response class.
|
||||
*/
|
||||
public toResponse(): ResponsePrincipal {
|
||||
return new ResponseUserGroup(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user