GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Added user-based restrict editing and approval workflow sample in JavaScript DOCX Editor by suriyaprakasamr · Pull Request #14 · SyncfusionExamples/JavaScript-ES6-DOCX-Editor-Examples

Conversation

@suriyaprakasamr

@suriyaprakasamr suriyaprakasamr commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds a new document-protection sample (based on the getting-started sample) that demonstrates user-based document restrictions and approval workflows with the Syncfusion® JavaScript (ES6) DOCX Editor (Document Editor). It loads the shared Adventure Works Cycles SFDT (data-document-protection.json), which already holds the user-based editable ranges for Nancy's price values, and applies each user's document protection on the fly when a user is selected from the dropdown.

Changes

  • Page and heading: The page renders the Document Editor container with the heading "User based restrict editing and approval workflow in JavaScript DOCX Editor".
  • Document loading: The Adventure Works SFDT is loaded from src/resources/data/data-document-protection.json (base64 SFDT zip, unzipped client-side with ZipArchive from @syncfusion/ej2-compression — no extra packages).
  • User dropdown (top of the page): Lists the five users and binds the Document Editor's currentUser to the user's email. A permission banner shows the signed-in user's role.
  • Per-user restrictions:
    • Nancy ([email protected]) – ReadOnly protection with the editable ranges already embedded in the SFDT, so she can edit only the price values.
    • Andrew ([email protected]) – RevisionsOnly protection, so all his edits are tracked as revisions; the beforeAcceptRejectChanges event cancels his accept/reject actions, so he cannot approve changes.
    • Steven ([email protected]) – CommentsOnly protection, so he can insert comments only and cannot edit the content.
    • Michael ([email protected]) – no protection, full editing access; he reviews and accepts Andrew's revisions (approval workflow).
    • Laura ([email protected]) – ReadOnly protection plus isReadOnly = true; she can only read and export the document using the custom Export as DOCX / Export as PDF buttons (the PDF export uses the online service Export action).
  • Permissions table (right side): Displays each user, their email and their effective permissions.
  • README: Includes the introduction, how the sample works, project structure, how to run the sample, and the common Resources, Support and Feedback, License and About Syncfusion sections.

Testing

  • npm run build completes successfully (TypeScript strict mode passes with tsc --noEmit).
  • Verified with a headless browser:
    • Nancy: 3 editable ranges detected; typing outside the ranges is blocked; editing a price value inside her editable range succeeds.
    • Andrew: typing creates a revision (revisions.length = 1); revisions.acceptAll() is cancelled while he is signed in.
    • Michael: no protection; revisions.acceptAll() approves Andrew's revision (revisions.length becomes 0); free typing works.
    • Steven: comments can be inserted (comment count increases) while content edits are blocked.
    • Laura: document is read-only; saveAsBlob('Docx') returns a valid DOCX blob; both export buttons are present.
    • Switching users correctly stops the previous protection and enforces the new user's protection (verified protection types ReadOnly, RevisionsOnly, CommentsOnly, NoProtection).

Notes for reviewers

  • The sample reuses the getting-started build setup (webpack, gulp, protractor) without adding any new packages; @syncfusion/ej2-compression was already a dependency of @syncfusion/ej2-documenteditor.
  • The online demo service URL (https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/) is used only for the demo, as in the base sample.

📍 Bold Create session · 👤 Requested by @suriyaprakasamr · 🤖 Bold Create Agent

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Bold Create Agent and others added 2 commits November 12, 2026 17:02
Bold Create Agent @suriyaprakasamr
Add document-protection sample demonstrating user-based restrictions …
9489ea6
…and approval workflows

Demonstrates role-based editing access, track changes review, comments,
revision acceptance/rejection and an approval workflow using the
Adventure Works SFDT document with user-based editable ranges:

- Nancy edits only the price values via editable ranges (ReadOnly + ranges)
- Andrew edits with all changes tracked (RevisionsOnly), accept/reject blocked
- Steven inserts comments only (CommentsOnly)
- Michael has full editing and approves the tracked changes
- Laura is read-only and exports the document as DOCX and PDF

Based on the getting-started sample.

Co-authored-by: suriyaprakasamr <[email protected]>
Bold-Create-Session: https://app.boldcreate.ai/agent/chat/?threadId=12b07b78-1832-49fa-8f4a-31352769b404
@suriyaprakasamr
Modified as Ribbon mode.
47f2eb6
@suriyaprakasamr
suriyaprakasamr marked this pull request as ready for review November 12, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@suriyaprakasamr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.