The storage object
grants or rejects permissions
Saves the contentUserData for given contentId, dataType and subContentId
The id of the content to load user data from
Used by the h5p.js client
The id provided by the h5p.js client call
The userState as string
The user who is currently active; normally this is also the owner of the user data
Optional
contextId: stringan arbitrary value that can be used to save multiple states for one content - user tuple
Optional
asUserId: stringif the acting user is different from the owner of the user data, you can specify the owner here
the saved state as string
Deletes all states of a content object. Normally called when the content object is deleted.
Deletes a contentUserData object for given contentId and user id. Throws errors if something goes wrong.
the user for which the contentUserData object should be deleted
the user who is currently active
Deletes all finished data for a content object
the id of the content object
the currently active user
Deletes all user data of a content object, if its "invalidate" flag is set. This method is normally called, if a content object was changed and the user data has become invalid because of that.
Loads the content user data for given contentId and user. The returned data is an array of IContentUserData where the position in the array corresponds with the subContentId or undefined if there is no content user data.
The id of the content to load user data from
The user who is accessing the h5p. Normally this is also the user for who the integration should be generated.
Optional
contextId: stringan arbitrary value that can be used to save multiple states for one content - user tuple
Optional
asUserId: stringthe user for which the integration should be generated, if they are different from the user who is accessing the state
an array of IContentUserData or undefined if no content user data is found.
Loads the contentUserData for given contentId, dataType and subContentId
The id of the content to load user data from
Used by the h5p.js client
The id provided by the h5p.js client call
The user who is accessing the h5p. Normally this is also the user for who the state should be fetched.
Optional
contextId: stringan arbitrary value that can be used to save multiple states for one content - user tuple
Optional
asUserId: stringIf set, the state of this user will be fetched instead of the one of `actingUser'
the saved state as string or undefined when not found
Saves data when a user completes content.
The content id to delete.
the score the user reached as an integer
the maximum score of the content
the time the user opened the content as UNIX time
the time the user finished the content as UNIX time
the time the user needed to complete the content (as integer)
The user who triggers this method via /setFinished
The ContentUserDataManager takes care of saving user data and states. It only contains storage-agnostic functionality and depends on a ContentUserDataStorage object to do the actual persistence.