- Home
- Forum
- ASP.NET Core - EJ 2
- AccessRule lock 1st level folders but authorise management of their content (SA / Admin roles)
AccessRule lock 1st level folders but authorise management of their content (SA / Admin roles)
Hello,
I'm using File Manager Syncfusion (EJ2) with two roles: SA (everything allowed) and Admin.
The tree structure is as follows:
- Documents
- Public
- Tes1
- Test2
- Interne
- Public
I would like :
- SA: full access (OK).
- Admin:
- /Documents (root) → read-only (no root creation).
- /Documents/ (e.g. Public, Internal)* → the folder itself should be locked (no rename/delete/move), but its contents should be manageable (add files, create/rename/delete subfolders).
- Subfolders from 2ᵉ level up (e.g. /Documents/Public/Test) → fully editable.
I tried this with combinations of AccessRule rules like:
But either the subfolders remain locked, or the 1st level folders become deletable, which I don't want.
👉 How do I write AccessRule correctly to:
- Prohibit the modification of 1st level folders,
- while allowing management of their contents and deeper subfolders?
Thanks for your help!
Hi Chaffois Quentin
To configure the Syncfusion EJ2 File Manager with your specific access requirements, you'll need to implement a structured set of access rules that provide granular control over different paths and roles. Here's how to set up the rules for your scenario:
Setting Up Access Rules for Admin Role :
You'll need to define multiple rules to achieve the exact permissions you want. Refer the code snippet below :
[FileManagerAccessController.cs]
|
public AccessDetails GetRules() { AccessDetails accessDetails = new AccessDetails(); List<AccessRule> Rules = new List<AccessRule> {
// Root /Documents folder - read-only for Admin new AccessRule { Path = "/Documents", Role = "Admin", Read = Permission.Allow, Write = Permission.Deny, Copy = Permission.Deny, WriteContents = Permission.Allow, // Allow modifying contents inside Upload = Permission.Deny, Download = Permission.Allow, IsFile = false },
// First-level folders - prevent rename/delete/move but allow access new AccessRule { Path = "/Documents/Employees", Role = "Admin", Read = Permission.Allow, Write = Permission.Deny, // Prevents rename/delete of the folder itself Copy = Permission.Deny, // Prevents copying of the folder WriteContents = Permission.Allow, // Allow modifying contents inside Upload = Permission.Allow, // Allow file uploads inside this folder Download = Permission.Allow, IsFile = false },
new AccessRule { Path = "/Documents/Nature", Role = "Admin", Read = Permission.Allow, Write = Permission.Deny, // Prevents rename/delete of the folder itself Copy = Permission.Deny, // Prevents copying of the folder WriteContents = Permission.Allow, // Allow modifying contents inside Upload = Permission.Allow, // Allow file uploads inside this folder Download = Permission.Allow, IsFile = false },
// Deeper subfolders - full management new AccessRule { Path = "/Documents/Employees/*", // full access to all subfolders inside first-level folders Role = "Admin", Read = Permission.Allow, Write = Permission.Allow, Copy = Permission.Allow, WriteContents = Permission.Allow, Upload = Permission.Allow, Download = Permission.Allow, IsFile = false }, }; accessDetails.AccessRules = Rules; accessDetails.Role = "Admin"; // Set this dynamically based on user's role return accessDetails; } |
For your reference we attached a sample and provider.
Sample: Attached as a zip file.
Provider: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Provider
Check out the sample and let us know if you need any further assistance.
Regards,
Saravanan J
Attachment: CoreSample_bfdcc8c8.zip
- 1 Reply
- 2 Participants
-
CQ Chaffois Quentin
- Sep 10, 2025 01:49 PM UTC
- Sep 15, 2025 03:55 PM UTC