new AccessMode(acs)
Helper class for handling access mode.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
acs |
AccessMode
|
Object
|
AccessMode to copy or access mode object received from the server. |
Methods
(static) decode(mode) → {number}
Parse string into an access mode value.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
mode |
string
|
Number
|
either a String representation of the access mode to parse or a set of bits to assign. |
Returns:
- Type:
-
number
- Access mode as a numeric value.
(static) encode(val) → {string}
Convert numeric representation of the access mode into a string.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
val |
number
|
access mode value to convert to a string. |
Returns:
- Type:
-
string
- Access mode as a string.
(static) getExcessive() → {string}
Get permissions present in 'given' but missing in 'want'.
Inverse of Tinode.AccessMode#getMissing
- Source:
Returns:
- Type:
-
string
permissions present in given but missing in want.
(static) getGiven() → {string}
Get 'given' value as a string.
- Source:
Returns:
- Type:
-
string
- given value.
(static) getMissing() → {string}
Get permissions present in 'want' but missing in 'given'.
Inverse of Tinode.AccessMode#getExcessive
- Source:
Returns:
- Type:
-
string
permissions present in want but missing in given.
(static) getMode() → {string}
Get
mode
value as a string.
- Source:
Returns:
- Type:
-
string
-
mode
value.
(static) getWant() → {string}
Get 'want' value as a string.
- Source:
Returns:
- Type:
-
string
- want value.
(static) isAdmin(sideopt) → {boolean}
Check if either one of Owner (O) or Approver (A) flags is set.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
side |
string
|
<optional> |
which permission to check: given, want, mode; default: mode. |
Returns:
- Type:
-
boolean
-
true
if flag is set.
(static) isApprover(sideopt) → {boolean}
Check if Approver (A) flag is set.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
side |
string
|
<optional> |
which permission to check: given, want, mode; default: mode. |
Returns:
- Type:
-
boolean
-
true
if flag is set.
(static) isDeleter(sideopt) → {boolean}
Check if Deleter (D) flag is set.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
side |
string
|
<optional> |
which permission to check: given, want, mode; default: mode. |
Returns:
- Type:
-
boolean
-
true
if flag is set.
(static) isJoiner(sideopt) → {boolean}
Check if Join (J) flag is set.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
side |
string
|
<optional> |
which permission to check: given, want, mode; default: mode. |
Returns:
- Type:
-
boolean
-
true
if flag is set.
(static) isMuted(sideopt) → {boolean}
Check if Presence (P) flag is NOT set.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
side |
string
|
<optional> |
which permission to check: given, want, mode; default: mode. |
Returns:
- Type:
-
boolean
-
true
if flag is set.
(static) isOwner(sideopt) → {boolean}
Check if Owner (O) flag is set.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
side |
string
|
<optional> |
which permission to check: given, want, mode; default: mode. |
Returns:
- Type:
-
boolean
-
true
if flag is set.
(static) isPresencer(sideopt) → {boolean}
Check if Presence (P) flag is set.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
side |
string
|
<optional> |
which permission to check: given, want, mode; default: mode. |
Returns:
- Type:
-
boolean
-
true
if flag is set.
(static) isReader(sideopt) → {boolean}
Check if Reader (R) flag is set.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
side |
string
|
<optional> |
which permission to check: given, want, mode; default: mode. |
Returns:
- Type:
-
boolean
-
true
if flag is set.
(static) isSharer(sideopt) → {boolean}
Check if either one of Owner (O), Approver (A), or Sharer (S) flags is set.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
side |
string
|
<optional> |
which permission to check: given, want, mode; default: mode. |
Returns:
- Type:
-
boolean
-
true
if flag is set.
(static) isWriter(sideopt) → {boolean}
Check if Writer (W) flag is set.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
side |
string
|
<optional> |
which permission to check: given, want, mode; default: mode. |
Returns:
- Type:
-
boolean
-
true
if flag is set.
(static) setGiven(g) → {AccessMode}
Assign
given
value.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
g |
string
|
Number
|
either a string representation of the access mode or a set of bits. |
Returns:
- Type:
-
AccessMode
-
this
AccessMode.
(static) setMode(m) → {AccessMode}
Assign value to 'mode'.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
m |
string
|
Number
|
either a string representation of the access mode or a set of bits. |
Returns:
- Type:
-
AccessMode
-
this
AccessMode.
(static) setWant(w) → {AccessMode}
Assign 'want' value.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
w |
string
|
Number
|
either a string representation of the access mode or a set of bits. |
Returns:
- Type:
-
AccessMode
-
this
AccessMode.
(static) update(val, upd) → {number}
Update numeric representation of access mode with the new value. The value
is one of the following:
- a string starting with
'+'
or '-'
then the bits to add or remove, e.g. '+R-W'
or '-PS'
.
- a new value of access mode
- Source:
Parameters:
Name | Type | Description |
---|---|---|
val |
number
|
access mode value to update. |
upd |
string
|
update to apply to val. |
Returns:
- Type:
-
number
- updated access mode.
(static) updateAll(val) → {AccessMode}
Update 'want', 'give', and 'mode' values.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
val |
AccessMode
|
new access mode value. |
Returns:
- Type:
-
AccessMode
-
this
AccessMode.
(static) updateGiven(u) → {AccessMode}
Update 'given' value.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
u |
string
|
string representation of the changes to apply to access mode. |
Returns:
- Type:
-
AccessMode
-
this
AccessMode.
(static) updateMode(u) → {AccessMode}
Update
mode
value.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
u |
string
|
string representation of the changes to apply to access mode. |
Returns:
- Type:
-
AccessMode
-
this
AccessMode.
(static) updateWant(u) → {AccessMode}
Update 'want' value.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
u |
string
|
string representation of the changes to apply to access mode. |
Returns:
- Type:
-
AccessMode
-
this
AccessMode.