Added toString for permissions

ref #6
This commit is contained in:
Nicolai Ort 2020-12-18 17:17:02 +01:00
parent 6237e62a03
commit 445e96dcdf
2 changed files with 10 additions and 0 deletions

View File

@ -36,4 +36,11 @@ export class Permission {
*/
@Column({ type: 'varchar' })
action: PermissionAction;
/**
* Turn this into a string for exporting (and jwts).
*/
public toString(): string {
return this.target + ":" + this.action;
}
}

View File

@ -129,6 +129,9 @@ export class User extends Principal {
return final_permissions
}
/**
* Turn this into a response.
*/
public toResponse(): ResponsePrincipal {
return new ResponseUser(this);
}