-
Notifications
You must be signed in to change notification settings - Fork 180
Open
Description
Context:
I want to be able to define the roles in my application as a const enum
in TypeScript like so
const enum ACRolesEnum {
blocks,
event,
holidays,
photos
}
const enum RoleTypes {
User,
Admin,
Developer,
Scheduler
}
roles
.grant(RoleTypes.User)
.readOwn(��ACRolesEnum.photos)
.readOwn(ACRolesEnum.event)
.grant(RoleType.Developer)
.readAny(ACRolesEnum.photos)
.lock()
Problem:
However, Typscript enums use number
s by default, and .read
, .update
, etc. only accept string | string[]
. (and .grant
also accepts IAccessInfo
)
Proposal:
I've read through a lot of the code that uses these roles, and I can't see any reason we couldn't also accept number | number[]
as part of it.
Workaround:
Use string
enums instead, like
const enum ACRolesEnum {
blocks = 'blocks',
event = 'event',
}
Metadata
Metadata
Assignees
Labels
No labels