parent
cc68948a20
commit
b2bd6173a5
@ -96,7 +96,7 @@ export class PermissionController {
|
|||||||
return new ResponsePermission(existingPermission);
|
return new ResponsePermission(existingPermission);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.permissionRepository.update(oldPermission, await permission.toPermission());
|
await this.permissionRepository.save(await permission.updatePermission(oldPermission));
|
||||||
|
|
||||||
return new ResponsePermission(await this.permissionRepository.findOne({ id: permission.id }, { relations: ['principal'] }));
|
return new ResponsePermission(await this.permissionRepository.findOne({ id: permission.id }, { relations: ['principal'] }));
|
||||||
}
|
}
|
||||||
|
@ -37,14 +37,12 @@ export class UpdatePermission {
|
|||||||
/**
|
/**
|
||||||
* Converts a Permission object based on this.
|
* Converts a Permission object based on this.
|
||||||
*/
|
*/
|
||||||
public async toPermission(): Promise<Permission> {
|
public async updatePermission(permission: Permission): Promise<Permission> {
|
||||||
let newPermission: Permission = new Permission();
|
permission.principal = await this.getPrincipal();
|
||||||
|
permission.target = this.target;
|
||||||
|
permission.action = this.action;
|
||||||
|
|
||||||
newPermission.principal = await this.getPrincipal();
|
return permission;
|
||||||
newPermission.target = this.target;
|
|
||||||
newPermission.action = this.action;
|
|
||||||
|
|
||||||
return newPermission;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user