mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 21:16:09 +00:00
fix: confusing behavior on permissions
This commit is contained in:
parent
630be18ae9
commit
16b9ee3bc5
@ -25,13 +25,21 @@ export class Permissions implements BitField<bigint> {
|
|||||||
/** Stores all entity permissions */
|
/** Stores all entity permissions */
|
||||||
bitfield: bigint;
|
bitfield: bigint;
|
||||||
|
|
||||||
/** Wheter to grant all other permissions to the administrator */
|
/**
|
||||||
|
* Wheter to grant all other permissions to the administrator
|
||||||
|
* **Not to get confused with Permissions#admin**
|
||||||
|
*/
|
||||||
__admin__ = true;
|
__admin__ = true;
|
||||||
|
|
||||||
constructor(bitfield: PermissionResolvable) {
|
constructor(bitfield: PermissionResolvable) {
|
||||||
this.bitfield = Permissions.resolve(bitfield);
|
this.bitfield = Permissions.resolve(bitfield);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Wheter the bitfield has the administrator flag */
|
||||||
|
get admin(): boolean {
|
||||||
|
return (this.bitfield & BigInt(Permissions.Flags.ADMINISTRATOR)) === this.bitfield;
|
||||||
|
}
|
||||||
|
|
||||||
get array(): PermissionString[] {
|
get array(): PermissionString[] {
|
||||||
// unsafe cast, do not edit
|
// unsafe cast, do not edit
|
||||||
const permissions = Object.keys(Permissions.Flags) as PermissionString[];
|
const permissions = Object.keys(Permissions.Flags) as PermissionString[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user