Permission-based editing
Edit only what you are allowed to edit
The document contains protected and editable ranges. Your current permission user determines which areas can be changed in the editor.
Current permission user
New edits use this identity when the document checks permissions.
USER
D
development@textcontrol.comPermission profile loaded
What to try
Compare the editable areas for different users.
LIVE
Edit an assigned rangeBlue-highlighted content is available to the selected user.
Edit an Everyone rangeGreen-highlighted content is available to every permission user.
Try protected contentContent outside an allowed range remains locked in the editor.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Document Protection
Document protection separates the document from the identity that is currently editing it. A protected template can assign individual ranges to named users while leaving other ranges available to `Everyone`.
Key members
Assign the permission identity
TextControlSettings.UserNames
Open the Permissions ribbon
TXTextControl.ribbon.selectedTab
Reload with another identity
window.location.assign
How it works
The editing_protected.tx template contains ranges with permission metadata. When the editor is initialized with TextControlSettings.UserNames, TX Text Control compares that identity with the users assigned to each protected range.
The page keeps the current user visible and reloads the editor when another identity is selected. Reloading is intentional: the permission identity is part of the editor configuration, so it should be established before the protected document is loaded.
Use the Permissions ribbon to inspect protection in the live editor. Assigned ranges can be edited by their users, ranges assigned to Everyone can be edited by all users, and other protected content remains unavailable for editing.
@Html.TXTextControl().TextControl(settings => {
settings.Dock = DockStyle.Fill;
settings.UserNames = new[] { currentUser };
}).LoadText(protectedTemplate, StreamType.InternalUnicodeFormat)
TXTextControl.addEventListener("textControlLoaded", () => {
TXTextControl.addEventListener("ribbonTabsLoaded", () => {
TXTextControl.ribbon.selectedTab = "tabPermissions";
});
});
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Provides the browser-based TX Text Control document editor and JavaScript API.
dotnet add package TXTextControl.Web --version 34.4.0
TXTextControl.Web.DocumentEditor.Backend
34.4.0
Hosts the WebSocket-based backend used by the browser document editor.
dotnet add package TXTextControl.Web.DocumentEditor.Backend --version 34.4.0