1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00
unleash.unleash/src/lib/error/no-access-error.ts
Ivar Conradi Østhus e1fbe9d013
feat: Default roles and RBAC permission checker. (#735)
This PR Introduces first steps towards RBAC according to our specifications. Rbac will assume users to exist in the Unleash user table with a unique id. This is required to make correct mappings between users and roles.
2021-03-11 22:51:58 +01:00

27 lines
581 B
TypeScript

class NoAccessError extends Error {
permission: string;
name: string;
message: string;
constructor(permission: string) {
super();
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.permission = permission;
this.message = `You need permission=${permission} to perform this action`;
}
toJSON(): any {
return {
permission: this.permission,
message: this.message,
};
}
}
export default NoAccessError;
module.exports = NoAccessError;