- Developer home
- Embed editors
- Permissions and modes
Permissions and modes
This page is not yet translated into your language; it is shown in English.
Permissions and modes
The token says what the person may do: a mode, and permissions that narrow it. They follow ONLYOFFICE Docs' document.permissions and Microsoft WOPI's CheckFileInfo (UserCanWrite, ReadOnly, DisablePrint, DisableExport, DisableCopy), and the three restricted modes are Word's own Restrict Editing choices. ui.features in the page can only turn more off, never on.
// A reviewer: every edit is a tracked change, no accepting or rejecting,
// PDF exports only, nothing copied out, a watermark on screen and in every PDF.
const token = await createSessionToken({
appId, secretKey,
file: { key: "contract-42", name: "contract.docx", url: signedUrl },
user: { id: user.id, name: user.name, email: user.email, color: "#1f77b4" },
mode: "review", // edit | view | comment | review | fillForms
permissions: {
download: true, // File > Export / Download
print: true,
copy: false, // nothing leaves through the clipboard
export: ["pdf"], // the formats File > Export may write
acceptRejectChanges: false, // default false in review, true in edit
comment: true,
manageComments: false, // resolve / delete only one's own comments
},
watermark: {
text: "{user.email} · {datetime}", // {user.name} {user.email} {user.id} {date} {datetime}
opacity: 0.15, angle: -30, fontSize: 22, color: "#808080",
inExports: true, // stamped into every exported and printed PDF
},
});| mode | The person can | Enforced by |
|---|---|---|
edit (default) | Everything the editor does. | — |
view | Read, search, and (when allowed) print and download. No edit, no comment, no save. | Server: their account is a viewer of the document; every write and the save are refused. |
comment | Read and comment (add, reply). The text is read only (Word's Comments restriction). | Server: no file or picture inserted, no version restored, no page structure changed. Editor: only comment steps are accepted. |
review | Edit, with every change recorded as a tracked change (Word's Tracked changes restriction). Accept/Reject only with acceptRejectChanges. | Server: no version restored or structure changed. Editor: tracking cannot be turned off; accept/reject refused. |
fillForms | Fill the document's form fields (content controls) only (Word's Filling in forms). No comments. | Server: as comment, and no comments. Editor: every edit outside a field is refused. |
comment, review and fillForms are lanes of the Word editor (.docx and the formats it opens). A workbook, a deck or a PDF opened in one of them opens read only: the session's effective_mode is view (onReady's effectiveMode, and modeNote: "document_only_mode"), never with more rights than the token gave.
One exception: a PDF opened in fillForms is filled in (see Filling in a PDF form, below).
And a workbook, a deck or a PDF opened in comment or review is commented on (see Commenting on a workbook, a deck or a PDF, below).
A code file or a handwriting document has no comments, tracked changes or form fields: comment, review and fillForms open it read only too, and only edit writes it.
| permissions. | Default | What it does | Enforced by |
|---|---|---|---|
download | true | File › Export, Download and every file the editor would save. | Server: the page export refuses (embed_download_not_allowed) and a save's download link is not handed to the session. Editor: nothing is saved (onDownload: refused). |
print | true | Print, ⌘P / Ctrl+P. | Server: a print's PDF is refused (embed_print_not_allowed). Editor: every print path refused. |
copy | true | Copy, cut and drag out of the editor (paste in still works). | Editor (as in WOPI and ONLYOFFICE: the clipboard is the browser's). |
export | every format | The formats File › Export may write, e.g. ["pdf"]. | Server: other formats refused (embed_export_format_not_allowed). Editor: the same. |
acceptRejectChanges | true in edit, false otherwise | Accept and reject tracked changes. | Editor. |
comment | true in edit, comment, review | Write comments at all. | Server: mentions refused (embed_comment_not_allowed). Editor. |
manageComments | true | false: resolve and delete only one's own comments (ONLYOFFICE's editCommentAuthorOnly / deleteCommentAuthorOnly). | Editor. |
- What only the editor can enforce is what lives inside the document itself: a Word document's comments, tracked changes and form fields are its content, so a comment, review or fill-in session writes the document (as ONLYOFFICE's editor enforces the same permissions). The server holds everything around it: who may write at all, saving, exports, prints, downloads, inserted files, versions.
- Printing hands the person a PDF (the print dialog saves one), so print: true admits a print's PDF even where download is false.
- A partner's comment, review or fill-in user is saved as one of the document's editors (save.editors), like an edit session.
Filling in a PDF form
A PDF opened in fillForms is filled in, as in ONLYOFFICE's PDF editor and Acrobat: the person fills the file's own form fields (text, check boxes, radio buttons, combo and list boxes, dates typed in their format) and signs its signature fields with a drawn, typed or uploaded signature. Nothing else of the file changes, and the saved PDF holds each value as the field's own value, so every reader shows it.
- Enforced by the server: the session's account only reads the document, so the editor's own saves, uploads and live room are refused (403). Its fills go through the session's form routes, which check each value against the file's field (read only, its choices, its maximum length, one line) and refuse anything else.
- Roles: a field assigned to a role (Forms › Roles in the editor) is filled only by a session whose user.roles names that role first; a field given to no role is anyone's, and a session with no roles fills every field.
- Complete & Submit: the editor's Submit checks that each required field of the person's is filled (409 embed_form_incomplete names the missing ones) and sends the form.submitted event with the role and the values; the next save sends you the filled file.
- The signature is visible, a picture on the signature field marked as non-cryptographic: it certifies nothing. For a digital signature, sign the saved file with your signing service.
Commenting on a workbook, a deck or a PDF
A workbook, a deck or a PDF opened in comment is commented on, as in ONLYOFFICE and Microsoft 365: the person adds comments (on a cell, on a slide or one of its objects, on a PDF page), replies, edits their own words, and resolves, reopens and deletes comments. Nothing else of the file changes, and the saved file holds the comments in its own format: Excel threaded comments, PowerPoint comments, PDF notes with their replies and review states. review is the same there, since Excel and PowerPoint have no tracked changes: effectiveMode "comment", modeNote "review_as_comments".
- Enforced by the server: the session's account only reads the document, so the editor's own saves, uploads and live room are refused (403). Its comments go through the session's comment route, which makes one comment change at a time and refuses anything else.
- permissions.manageComments: false keeps resolving, reopening and deleting to the person's own comments (403 embed_comment_not_yours), and nobody edits another person's words. permissions.comment: false refuses every comment (embed_comment_not_allowed).
- You hear of these comments as of any others: comment.created, comment.updated, comment.resolved and comment.deleted when the document is saved.