With TX Text Control, document content can be protected by restricting formatting and editing options. Additionally, exceptions can be applied to specific regions within the document and assigned to users with editing permissions. This article explores document protection use cases in the healthcare domain. It also explains how to assign usernames, configure edit modes, and use editable regions based on user roles using the Document Editor in an ASP.NET Core application.
Document Protection in Healthcare Systems
Document protection is a valuable feature in TX Text Control that can be implemented in healthcare systems. Healthcare providers maintain documents for each patient to store and process important information, such as medical records, forms, and insurance billing. Below are some key use cases that show how document protection can be applied to these documents:
- Electronic medical and health records (EMR and EHR): With TX Text Control, developers and users (admins) can protect records from unauthorized edits while allowing specific roles, such as doctors, nurses, or patients, to modify relevant sections by specifying editable regions and user permissions using the ribbon.
- Consent forms: Developers can lock the content of the consent form to prevent changes. At the same time, they can allow patients to fill in specific fields, such as their name and signature.
- Insurance and billing documents: Editable sections can be assigned to the billing department and patients while keeping the rest of the document protected.
By integrating document protection, hospitals, clinics, and insurance providers ensure data security and accuracy by allowing role-based access control to modify necessary fields. While these are key use cases, TX Text Control's document protection can be applied across various industries beyond healthcare, tailored to individual needs and specific requirements.
Learn More
To learn more about digital form workflows with electronic signatures and further use cases related to insurance claim forms, refer to these articles:
Healthcare Use Case: Digital Forms Workflow with Electronic Signatures
Use Case: Create, Deploy and Process Insurance Claim Forms
How to Use Document Protection with the TX Text Control Document Editor
Tutorial
Follow this tutorial to initialize and configure the TX Text Control Document Editor with ASP.NET Core:
When applying document protection using TX Text Control, you can choose to fully lock the document, allow certain formatting options, or define editable regions for specific users. All the editing and formatting restrictions apply only when the Editmode ╰ TX Text Control .NET Server for ASP.NET
╰ Web Namespace
╰ TextControl Class
╰ EditMode Property
Specifies or returns a value of type Web.EditMode indicating whether the document's text is read-only, can be selected or is editable. is set to ReadAndSelect. From a technical perspective, the document is password-encrypted. When this encrypted file is loaded, it remains restricted or read-only. To enable editing, the user must provide the correct password.
This tutorial shows how to create and load a protected document, display the current user, and switch users using a dropdown button to test document protection.
Create the Protected Document
Assume that you are an admin editor responsible for managing all user-specific actions, such as configuring document permissions. Begin by creating an encrypted document.
Learn More
Text Control offers options to create an encrypted document, either via the UI or programmatically. Refer to the following articles:
Sneak Peek X15: MS Word Compatible Document Protection and Editable Regions
X15: Protected Documents Explained Simply
X15: Protected Documents Explained Simply - Part II
In this example, a Text Control formatted (.tx) document is generated using the TX Text Control Words with encryption enabled. The encrypted document includes editable regions exclusively assigned to the Doctor and Insurer roles. It is then uploaded to the Documents folder of the ASP.NET Core application.
Load the Protected Document, Set Up Usernames, and Edit Modes
To load the protected document and set the default user, update HomeController.cs under the Controllers folder in your ASP.NET Core MVC application. The following code retrieves the username from the query string, defaulting to the Insurer role if none is provided, and sets the path of the encrypted document to be loaded into the view.
public IActionResult Index([FromQuery] string? user) | |
{ | |
ViewData["User"] = user ?? "Insurer"; | |
ViewData["DocumentPath"] = Path.Combine("Documents", "sampledoc.tx"); | |
return View(); | |
} |
To add the control to the view, open the Index.cshtml file located in the Views/Home folder. Add the following Razor markup to include the document path and current user.
@using TXTextControl.Web.MVC | |
@{ | |
var userName = (string) ViewData["User"]!; | |
var docPath = (string) ViewData["DocumentPath"]!; | |
} |
The Editmode ╰ TX Text Control .NET Server for ASP.NET
╰ Web Namespace
╰ TextControl Class
╰ EditMode Property
Specifies or returns a value of type Web.EditMode indicating whether the document's text is read-only, can be selected or is editable. can be set to ReadOnly, ReadAndSelect, or Edit. Also, it can be set to UsePassword, but this option must be combined exclusively with the ReadAndSelect option using a bitwise OR operation. The following code snippet shows how to initialize the Document Editor with the ReadAndSelect and UsePassword edit modes. A specific username is set (Insurer in this case) using the User ╰ TX Text Control .NET Server for ASP.NET
╰ Web Namespace
╰ TextControl Class
╰ UserNames Property
Gets or sets a list of names specifying users who have access to editable regions. property that accepts an array of names, where the first entry represents the current user.
@Html.TXTextControl().TextControl(settings => | |
{ | |
settings.UserNames = new[] { userName }; | |
settings.EditMode = TXTextControl.Web.EditMode.ReadAndSelect | TXTextControl.Web.EditMode.UsePassword; | |
}).LoadText(docPath, TXTextControl.Web.StreamType.InternalUnicodeFormat).Render() |
A dialog box appears, prompting the user to enter a password to unlock the edit mode. This example reproduces a scenario where only the admin editor, or a user with password access, can unlock and edit the protected regions of the document. In the above code, UsePassword is enabled to show how password-protected editing looks and works in the Document Editor.
Switch Between User Roles to Test Document Protection
Use the following HTML snippet to simulate logging in as different user roles. It displays the current user, allows role selection via a dropdown, and updates the view based on the selected role when the "Set User" button is clicked. The selected username is added to the URL as a query string, letting the page reload with the new user context.
<div class="form-group col-lg-5 mt-3"> | |
<p>Logged in as: <strong>@userName</strong></p> | |
<select class="form-control mt-3" id="users"> | |
<option value="Doctor">Doctor</option> | |
<option value="Insurer">Insurer</option> | |
</select> | |
<button onclick="ReloadWithUser()" class="btn btn-success mt-3">Set User</button> | |
</div> |
And the corresponding JavaScript function ReloadWithUser is triggered:
function ReloadWithUser() { | |
window.location = document.location.origin + | |
document.location.pathname + | |
"?user=" + document.getElementById("users").value; | |
} |
By default, the Insurer is set as a current user when the document is initialized. The Insurer can edit only the region assigned to the Insurer role, as well as any section marked as editable by all users. The Insurer does not have permission to edit the region assigned to the Doctor role or any fully protected sections. This supports role-based editing and highlights the importance of document protection in managing user-specific access.
The user role is set to Doctor when Doctor is selected from the dropdown and the "Set User" button is triggered:
Conclusion
This article explains how to use TX Text Control's document protection features in an ASP.NET Core application, including key properties for setting edit modes, usernames, and editable regions. As a result, your application can easily be configured to meet the document protection needs of your business processes.