Protected Optional$allowlistIf this is defined, then it lists the only properties that will be accepted from incoming JSON. Any other properties will be ignored.
If you use an allowlist, you don't need to use protectedData, since you can simply leave those entries out of allowlistData.
Protected Optional$allowlistIf this is defined, then it lists the only tags that will be accepted from incoming JSON. Any other tags will be ignored.
Protected$clientThe names of methods allowed to be called by the frontend with serverCall.
Protected$dataThe data proxy object.
Protected$dataThe data proxy handler.
Protected$dataThe actual data store.
Protected$isWhether this instance is a sleeping reference.
The instance of Nymph to use for queries.
Optional$originalUsed to save the current email address to send verification if it changes from the frontend.
If you are changing a user's email address and want to bypass email verification, don't set this.
Optional$originalUsed to save the current username for domain admin permissions.
Protected$privateProperties that will not be serialized into JSON with toJSON(). This can be considered a denylist, because these properties will not be set with incoming JSON.
Clients CAN still determine what is in these properties, unless they are also listed in searchRestrictedData.
Protected$protectedProperties that can only be modified by server side code. They will still be visible on the frontend, unlike $privateData, but any changes to them that come from the frontend will be ignored.
In addition to what's listed here, all of the access control properties will be included when Tilmeld is being used. These are:
You should modify these through client enabled methods or the $save method instead, for safety.
Protected$protectedTags that can only be added/removed by server side code. They will still be visible on the frontend, but any changes to them that come from the frontend will be ignored.
Protected$sdataThe actual sdata store.
Protected$sleepingThe reference to use to wake.
Protected$wakeA promise that resolved when the entity's data is wake.
The creation date of the entity as a Unix timestamp in milliseconds.
The entity's Globally Unique ID.
This is a 12 byte number represented as a lower case HEX string (24 characters).
The modified date of the entity as a Unix timestamp in milliseconds.
Array of the entity's tags.
StaticclassThe lookup name for this entity.
This is used for reference arrays (and sleeping references) and client requests.
StaticclientThe names of static methods allowed to be called by the frontend with serverCallStatic.
StaticETYPEThe instance of Tilmeld to use for queries.
StaticnymphThe instance of Nymph to use for queries.
StaticpubWhether this entity should publish changes to PubSub servers.
StaticrestWhether this entity should be accessible on the frontend through the REST server.
If this is false, any request from the client that attempts to use this entity will fail.
StaticsearchProperties that will not be searchable from the frontend. If the frontend includes any of these properties in any of their clauses, they will be filtered out before the search is executed.
Add one or more tags.
List of tags.
Search the array for this object and return the corresponding index.
If strict is false, is() is used to compare. If strict is true,
equals() is used.
The array to search.
Optionalstrict: booleanWhether to use stronger comparison.
The index if the object is in the array, -1 if it isn't.
Check if this is a sleeping reference.
A frontend accessible method to change the user's password.
The input data from the client.
An object with a boolean 'result' entry and a 'message' entry.
Protected$checkCheck if this is a sleeping reference and throw an error if so.
Check that an email is unique.
An object with a boolean 'result' entry and a 'message' entry.
Check the given password against the user's.
The password in question.
True if the passwords match, otherwise false.
Check that a phone number is unique.
An object with a boolean 'result' entry and a 'message' entry.
Check the given code against the user's TOTP secret.
The code in question.
True if the code is valid, otherwise false.
Check that a username is valid.
An object with a boolean 'result' entry and a 'message' entry.
Replace any referenced entities in the data with sleeping references.
Calling this function ensures that the next time a referenced entity is accessed, it will be retrieved from the DB (unless it is in Nymph's cache).
Delete the object from storage.
True on success, false on failure.
Perform a more strict comparison of this object to another.
The object to compare.
True or false.
Check to see if a user has an ability.
This function will check both user and group abilities, if the user is marked to inherit the abilities of its group.
If ability is undefined, it will check to see if the user is currently
logged in.
If the user has the "system/admin" ability, this function will return true.
Optionalability: stringThe ability.
True or false.
Get the client enabled methods.
The names of methods allowed to be called by the frontend with serverCall.
Used to retrieve the data object.
This should only be used by Nymph to save the data into storage.
OptionalincludeSData: booleanWhether to include the serialized data as well.
OptionalreferenceOnlyExisting: booleanWhether to only turn existing entities into references.
The entity's data object.
Build a gatekeeper cache object.
Get a GUID for the entity.
If the entity has already been saved, this will just return the GUID.
If the entity has not yet been saved, this will return a new GUID that gets
held by the entity. The guid property will remain null, but this method
will then always return the same GUID. When the entity is eventually saved
into the database, this GUID will be used.
A frontend accessible method to generate a new TOTP secret.
An object with 'uri', 'qrcode', and 'secret'.
Used to retrieve the serialized data object.
This should only be used by Nymph to save the data object into storage.
This method is used by Nymph to avoid unserializing data that hasn't been requested yet.
It should always be called after getData().
The entity's serialized data object.
Get the entity's tags.
Using this instead of accessing the tags prop directly will wake sleeping
references.
The entity's tags.
Get an array of strings that must be unique across the current etype.
When you try to save another entity with any of the same unique strings, Nymph will throw an error.
The default implementation of this method returns an empty array, meaning there are no uniqueness constraints applied to its etype.
Resolves to an array of entity's unique constraint strings.
Get an object that holds the same data as the entity.
This provides an object that can be validated.
A pure object representation of the entity.
Grant an ability.
The ability.
Check that the entity has all of the given tags.
List of tags.
True or false.
Check whether this object is in an array.
If strict is false, is() is used to compare. If strict is true,
equals() is used.
The array to search.
Optionalstrict: booleanWhether to use stronger comparison.
True if the object is in the array, false if it isn't.
Perform a less strict comparison of this object to another.
The object to compare.
True or false.
Accept JSON data from the client.
This function uses the security protection lists:
The input data. Please note, this will be modified (destroyed).
Allow to accept data that is older than the current data.
Accept JSON patch from the client.
This function uses the security protection lists:
The patch data. Please note, this will be modified (destroyed).
Allow to accept data that is older than the current data.
Log a user out of the system.
An object with a boolean 'result' entry and a 'message' entry.
Change the user's password.
The new password.
The resulting password or hash which is stored in the entity.
Used to set the data.
This should only be used by Nymph to push the data from storage or the client.
sdata is used by Nymph to avoid unserializing data that hasn't been
requested yet.
If source is set to "server", the data is coming from the DB or the
cache. If not, assume the data is coming from the client and can't be
trusted.
The data object.
Optionalsdata: SerializedEntityDataThe serialized data object.
Optionalsource: "server"If this is set to "server", the data is coming from the DB.
Protected$referenceRefresh the object from storage. (Bypasses Nymph's cache.)
If the object has been deleted from storage, the database cannot be
reached, or a database error occurs, refresh() will return 0.
False if the data has not been saved, 0 if it can't be refreshed, true on success.
Remove one or more tags.
List of tags.
A frontend accessible method to remove the TOTP secret from the user's account.
Optionaldata: { code: string; password: string }The input data from the client.
An object with a boolean 'result' entry and a 'message' entry.
Revoke an ability.
The ability.
A frontend accessible method to revoke all currently issued tokens.
The input data from the client.
An object with a boolean 'result' entry and a 'message' entry.
Save the object to storage.
True on success, false on failure.
This should never be accessible on the client.
A frontend accessible method to save a TOTP secret into the user's account.
The input data from the client.
An object with a boolean 'result' entry and a 'message' entry.
Send the user email verification/change/cancellation links.
True on success, false on failure.
Return a Nymph Entity Reference for this entity.
If the entity hasn't been saved yet (and has no GUID), it will use the
guaranteed GUID from $getGuaranteedGUID, unless existingOnly is true,
then it will return the entity.
OptionalexistingOnly: booleanWhether to only turn existing entities into references.
A Nymph Entity Reference array.
Set whether to use "skipAc" when accessing entity references.
True or false, whether to use it.
Static OptionalalterStaticcurrentStaticfactoryCreate or retrieve a new entity instance.
Note that this will always return an entity, even if the GUID is not found.
Optionalguid: stringAn optional GUID to retrieve.
StaticfactoryCreate a new sleeping reference instance.
Sleeping references won't retrieve their data from the database until they
are readied with $wake() or a parent's $wakeAll().
The Nymph Entity Reference to use to wake.
The new instance.
StaticfactoryCreate a new entity instance.
StaticfactoryStaticgetStaticgetStaticgetGet a string for full text search for one of an entity's properties.
The result will be tokenized and stored as the full text search index for use with "search" clauses.
Return null to not include any tokens in the full text search storage.
You shouldn't use any other entity data to transform the text, as it won't always be available. This function is meant for things like stripping HTML tags.
By default, returns the value if it is a string.
StaticgetGet an array of strings that must be unique across the current etype.
When you try to save another entity with any of the same unique strings, Nymph will throw an error.
The default implementation of this static method instantiates the entity,
assigns all of the given data, then calls $getUniques and returns its
output. This can have a performance impact if a lot of extra processing
happens during any of these steps. You can override this method to
calculate the unique strings faster, but you must return the same strings
that would be returned by $getUniques.
Resolves to an array of entity's unique constraint strings.
StaticloginStaticoffStaticonStaticrecoverRecover account details.
The input data from the client.
An object with a boolean 'result' entry and a 'message' entry.
StaticsendSend an account recovery link.
The input data from the client.
An object with a boolean 'result' entry and a 'message' entry.
A user data model.
Written by Hunter Perrin for SciActive.
Author
Hunter Perrin [email protected]
Copyright
SciActive Inc
See
http://nymph.io/