Skip to content

Interface: ExpiryOptions ​

Defined in: packages/core/src/expiry.ts:12

Last argument of assignRole(), givePermissionTo(), syncRoles() and syncPermissions() on a subject.

ts
await rbac.for(user).assignRole('on-call', { expiresAt: new Date(Date.now() + 8 * 3600_000) })

Properties ​

PropertyTypeDescriptionDefined in
expiresAt?Date | nullWhen the given links stop granting access. From that instant on, every check treats them as absent. null = never. Needs an adapter with expiry support ({ expiry: true }), else EXPIRY_NOT_SUPPORTED. assignRole() / givePermissionTo(): the latest call wins. Leaving it out makes the named links permanent, also when the subject already held them with an expiry. syncRoles() / syncPermissions(): with it, every listed link gets this expiry. Without it, links the subject keeps keep their expiry, and newly added links are permanent.packages/core/src/expiry.ts:22

Released under the MIT License. Inspired by spatie/laravel-permission.