Skip to content
On this page

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

NameType
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

NameType
CustomPerms""

Parameters

NameTypeDescription
type"character" | "account"
playerPlayerAn alt:V Player Entity
permCustomPerms | 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

NameTypeDescription
type"character" | "account"
playerPlayerAn alt:V Player Entity

Returns

Promise<void>

Defined in

server/systems/permission.ts:263


getAll

Usage

Athena.systems.permission.getAll<CustomPerms>(type, perm): Promise<player[] | player[]>

Get all documents that have a specified permission in their permissions array. Will return an empty array if no permissions are found.

Type parameters

NameType
CustomPerms""

Parameters

NameType
type"character" | "account"
permDefaultPerms | CustomPerms

Returns

Promise<player[] | player[]>

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

NameType
entityPlayer
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

NameType
entityVehicle
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

NameType
CustomPerms""

Parameters

NameTypeDescription
type"character" | "account"
playerPlayerAn alt:V Player Entity
permDefaultPerms | 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

NameType
CustomPerms""

Parameters

NameTypeDescription
type"character" | "account"
playerPlayerAn 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

NameType
CustomPerms""

Parameters

NameTypeDescription
type"character" | "account"
playerPlayerAn 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

NameType
CustomPerms""

Parameters

NameTypeDescription
type"character" | "account"
playerPlayerAn alt:V Player Entity
permDefaultPerms | 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

NameType
CustomPerms""

Parameters

NameType
type"character" | "account"
permDefaultPerms | CustomPerms
idsstring[]

Returns

Promise<void>

Defined in

server/systems/permission.ts:362

Created by Stuyk | Est. 2020