Permissions
Hierarchy
- Permissions
Index
Constructors
Properties
Methods
Constructors
publicconstructor
Constructor
Parameters
rest...permissions: Permission[]
Permission instances to create the Permissions instance from.
Returns Permissions
Properties
publicreadonlymask
Permission bitmask.
Since permissions are Uint64 bitmasks it must be represented
as a bigint. Watch out for number
type coercion if
reading this property directly.
While it is possible to use bitwise operations on the mask, to determine
the permissions, it is better to use the provided methods such as hasAny and hasAll.
Methods
publichasAll
Checks if mask has all of the specified permissions.
Parameters
rest...permissions: Permission[]
Permissions to compare with mask.
Returns boolean
true
if mask holds all of the specified permissions.
publichasAny
Checks if mask has any of the specified permissions.
Parameters
rest...permissions: Permission[]
Permissions to compare with mask.
Returns boolean
true
if mask holds any of the specified permissions.
publictoJson
Converts the Permission object to a JSON representation.
Returns string
The JSON representation of the Permission object.
publictoString
Converts to a human readable string.
Returns string
Human readable string.
publicstaticcopyToRef
Copies the permissions defined by permissions to the dst.permissions property.
Type parameters
- T: Pick<BimChangeBase, permissions>
Parameters
permissions: Permissions | { json: string } | Permission
Permission to copy to dst.permissions property.
dst: T
Change to use.
Returns T
Reference to dst.
publicstaticfromJsonObject
Create a Permissions instance from a permission mask represented as a bigint string. This is how permissions are represented in JSON as it is not possible to send 64bit integers in JSON.
Parameters
permission: string
If a real bigint string then it is converted to a Permissions instance. If it is a
falsy
returns a Permissions instance without any permissions. If it is atruthy
but not a bigint string then a exception is generated.
Returns Permissions
Permissions instance.
publicstaticjoin
Join one or more permissions into a single numeric permission mask. Permissions are bitwise OR:ed together.
Parameters
rest...permissions: (Permission | Permission[])[]
Permissions to join.
Returns bigint
Numeric permission mask. Can be compared directly with mask. Can also be used in constructor of Permissions.
publicstatictoString
Converts a number of Permission instances into a human readable string.
Parameters
rest...permissions: Permission[]
Permissions to convert.
Returns string
Human readable string.
Represents a set of permissions.