Document
Last modified by Manuel Leduc on 2024/12/30 16:48
Description
The authentication extension allows for user to authenticate as users of the current backend.
Supported Backends
Backend agnostic.
User
N/A
Admin
N/A
Developer
The DocumentService provides operations to access information about the current document, to change the current document, and to refresh the current document content.
/**
* Provide the operation to access a document.
*
* @since 0.11
*/
interface DocumentService {
/**
* @returns the reference to the current document, the current document changes when setCurrentDocument is called
*/
getCurrentDocument(): Ref<PageData | undefined>;
/**
* Returns a reference the document reference for the current document.
*
* @since 0.13
*/
getCurrentDocumentReference(): Ref<DocumentReference | undefined>;
/**
* Returns a serialized string of {@link getCurrentDocumentReference}.
*
* @since 0.13
*/
getCurrentDocumentReferenceString(): Ref<string | undefined>;
/**
* @returns the revision of the current document, or undefined if it's the last one
* @since 0.12
*/
getCurrentDocumentRevision(): Ref<string | undefined>;
/**
* @returns a ref to the loading state. true when the page is loading, false otherwise
*/
isLoading(): Ref<boolean>;
/**
* @returns a ref to the error for the loading of the current document. undefined if no error happened
*/
getError(): Ref<Error | undefined>;
/**
* Update the reference of the latest document.
* @param documentReference - the current document reference
* @param revision - the revision of the document, undefined for latest
*/
setCurrentDocument(documentReference: string, revision?: string): void;
/**
* Force reloading the content of the document without changing the current document reference
*/
refreshCurrentDocument(): void;
/**
* Register a change listener that will be executed on any document change
* made on the whole Cristal instance.
* @param change - the kind of change
* @param listener - the listener to register
* @since 0.12
*/
registerDocumentChangeListener(
change: DocumentChange,
listener: (page: PageData) => Promise<void>,
): void;
/**
* Notify that a document change happened. This will execute all registered
* listeners for the given kind of change.
* @param change - the kind of change
* @param page - the document changed
* @since 0.12
*/
notifyDocumentChange(change: DocumentChange, page: PageData): Promise<void>;
}
* Provide the operation to access a document.
*
* @since 0.11
*/
interface DocumentService {
/**
* @returns the reference to the current document, the current document changes when setCurrentDocument is called
*/
getCurrentDocument(): Ref<PageData | undefined>;
/**
* Returns a reference the document reference for the current document.
*
* @since 0.13
*/
getCurrentDocumentReference(): Ref<DocumentReference | undefined>;
/**
* Returns a serialized string of {@link getCurrentDocumentReference}.
*
* @since 0.13
*/
getCurrentDocumentReferenceString(): Ref<string | undefined>;
/**
* @returns the revision of the current document, or undefined if it's the last one
* @since 0.12
*/
getCurrentDocumentRevision(): Ref<string | undefined>;
/**
* @returns a ref to the loading state. true when the page is loading, false otherwise
*/
isLoading(): Ref<boolean>;
/**
* @returns a ref to the error for the loading of the current document. undefined if no error happened
*/
getError(): Ref<Error | undefined>;
/**
* Update the reference of the latest document.
* @param documentReference - the current document reference
* @param revision - the revision of the document, undefined for latest
*/
setCurrentDocument(documentReference: string, revision?: string): void;
/**
* Force reloading the content of the document without changing the current document reference
*/
refreshCurrentDocument(): void;
/**
* Register a change listener that will be executed on any document change
* made on the whole Cristal instance.
* @param change - the kind of change
* @param listener - the listener to register
* @since 0.12
*/
registerDocumentChangeListener(
change: DocumentChange,
listener: (page: PageData) => Promise<void>,
): void;
/**
* Notify that a document change happened. This will execute all registered
* listeners for the given kind of change.
* @param change - the kind of change
* @param page - the document changed
* @since 0.12
*/
notifyDocumentChange(change: DocumentChange, page: PageData): Promise<void>;
}
![France 2030 Logo](/xwiki/bin/download/Main/France2030Support/WebHome/Logo_France_2030.png?width=200&height=200&rev=1.2)
This project is being financed by the French State as part of the France 2030 program
Ce projet est financé par l’État Français dans le cadre de France 2030