Athena.systems.permission ​
Type Aliases ​
DefaultPerms ​
Ƭ DefaultPerms: "admin"
| "moderator"
Defined in ​
server/systems/permission.ts:7
SupportedDocuments ​
Ƭ SupportedDocuments: "account"
| "character"
Defined in ​
server/systems/permission.ts:8
Variables ​
default ​
• default: Object
Type declaration ​
Name | Type |
---|---|
add | <CustomPerms>(type : "character" | "account" , player : Player , perm : CustomPerms | DefaultPerms ) => Promise <boolean > |
clear | (type : "character" | "account" , player : Player ) => Promise <void > |
getAll | <CustomPerms>(type : "character" | "account" , perm : DefaultPerms | CustomPerms ) => Promise <player [] | player []> |
has | <CustomPerms>(type : "character" | "account" , player : Player , perm : DefaultPerms | CustomPerms ) => boolean |
hasAll | <CustomPerms>(type : "character" | "account" , player : Player , perms : (DefaultPerms | CustomPerms )[]) => boolean |
hasOne | <CustomPerms>(type : "character" | "account" , player : Player , perms : (DefaultPerms | CustomPerms )[]) => boolean |
remove | <CustomPerms>(type : "character" | "account" , player : Player , perm : DefaultPerms | CustomPerms ) => Promise <boolean > |
removeAll | <CustomPerms>(type : "character" | "account" , perm : DefaultPerms | CustomPerms , ids : string []) => Promise <void > |
Defined in ​
server/systems/permission.ts:439
Functions ​
add ​
Usage
Athena.systems.permission.add<CustomPerms
>(type
, player
, perm
): Promise
<boolean
>
Add a permission to an account or character.
Type parameters ​
Name | Type |
---|---|
CustomPerms | "" |
Parameters ​
Name | Type | Description |
---|---|---|
type | "character" | "account" | |
player | Player | An alt:V Player Entity |
perm | CustomPerms | DefaultPerms |
Returns ​
Promise
<boolean
>
Defined in ​
server/systems/permission.ts:229
clear ​
Usage
Athena.systems.permission.clear(type
, player
): Promise
<void
>
Clear all permissions for an account or character.
Parameters ​
Name | Type | Description |
---|---|---|
type | "character" | "account" | |
player | Player | An alt:V Player Entity |
Returns ​
Promise
<void
>
Defined in ​
server/systems/permission.ts:263
getAll ​
Get all documents that have a specified permission in their permissions array. Will return an empty array if no permissions are found.
Type parameters ​
Name | Type |
---|---|
CustomPerms | "" |
Parameters ​
Name | Type |
---|---|
type | "character" | "account" |
perm | DefaultPerms | CustomPerms |
Returns ​
Defined in ​
server/systems/permission.ts:330
getPermissions ​
Usage
Athena.systems.permission.getPermissions(entity
, type
): any
Get permissions for a given entity and type
Parameters ​
Name | Type |
---|---|
entity | Player |
type | "character" | "account" |
Returns ​
any
Defined in ​
server/systems/permission.ts:412
Usage
Athena.systems.permission.getPermissions(entity
, type
): any
Get permissions for a given entity and type
Parameters ​
Name | Type |
---|---|
entity | Vehicle |
type | "vehicle" |
Returns ​
any
Defined in ​
server/systems/permission.ts:413
has ​
Usage
Athena.systems.permission.has<CustomPerms
>(type
, player
, perm
): boolean
Check if a character or account has a single permission.
Type parameters ​
Name | Type |
---|---|
CustomPerms | "" |
Parameters ​
Name | Type | Description |
---|---|---|
type | "character" | "account" | |
player | Player | An alt:V Player Entity |
perm | DefaultPerms | CustomPerms |
Returns ​
boolean
Defined in ​
server/systems/permission.ts:277
hasAll ​
Usage
Athena.systems.permission.hasAll<CustomPerms
>(type
, player
, perms
): boolean
Check if a character or account has all the permissions.
Type parameters ​
Name | Type |
---|---|
CustomPerms | "" |
Parameters ​
Name | Type | Description |
---|---|---|
type | "character" | "account" | |
player | Player | An alt:V Player Entity |
perms | (DefaultPerms | CustomPerms )[] |
Returns ​
boolean
Defined in ​
server/systems/permission.ts:313
hasOne ​
Usage
Athena.systems.permission.hasOne<CustomPerms
>(type
, player
, perms
): boolean
Check if a character or account has a atleast one permission.
Type parameters ​
Name | Type |
---|---|
CustomPerms | "" |
Parameters ​
Name | Type | Description |
---|---|---|
type | "character" | "account" | |
player | Player | An alt:V Player Entity |
perms | (DefaultPerms | CustomPerms )[] |
Returns ​
boolean
Defined in ​
server/systems/permission.ts:295
remove ​
Usage
Athena.systems.permission.remove<CustomPerms
>(type
, player
, perm
): Promise
<boolean
>
Remove a permission from an account or character.
Type parameters ​
Name | Type |
---|---|
CustomPerms | "" |
Parameters ​
Name | Type | Description |
---|---|---|
type | "character" | "account" | |
player | Player | An alt:V Player Entity |
perm | DefaultPerms | CustomPerms |
Returns ​
Promise
<boolean
>
Defined in ​
server/systems/permission.ts:247
removeAll ​
Usage
Athena.systems.permission.removeAll<CustomPerms
>(type
, perm
, ids
): Promise
<void
>
Remove specified permission from all instances of an account or character. Automatically rebinds the document after updating.
Type parameters ​
Name | Type |
---|---|
CustomPerms | "" |
Parameters ​
Name | Type |
---|---|
type | "character" | "account" |
perm | DefaultPerms | CustomPerms |
ids | string [] |
Returns ​
Promise
<void
>