We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

AccessDetails doesnot contain a definition for FileRules and FolderRules

could you please let us know how can weaccess FileRules and FolderRules types


1 Reply

SA Shameer Ali Baig Sulaiman Ali Baig Syncfusion Team February 5, 2020 06:31 AM UTC

Hi Mahesh, 
 
Greetings from Syncfusion support. 
 
We have checked your reported query about access rules in FileManager component. You can define the access rules in controller. Using access control, you can restrict the access permission of user based on the role.  
 
Refer the below code snippet for defining the access rules. 
 
public HomeController() 
{ 
   this.operation.RootFolder(HostingEnvironment.MapPath("~/Content/Files")); 
   this.operation.SetRules(GetRules()); 
} 
public AccessDetails GetRules() 
{ 
AccessDetails accessDetails = new AccessDetails(); 
 
List<AccessRule> folderRule = new List<AccessRule> { 
// For Default User Read and write permisions is deny for documents folder.        
  new AccessRule { Path = "/Documents", Role = "Document Manager", Read = Permission.Deny, Write = Permission.Deny, Copy = Permission.Allow, WriteContents = Permission.Allow, Upload = Permission.Allow, Download = Permission.Deny }, 
  new AccessRule { Path = "/Documents/*", Role = "Document Manager", Read = Permission.Allow, Write = Permission.Allow, Copy = Permission.Allow, WriteContents = Permission.Allow, Upload = Permission.Allow, Download = Permission.Allow }, 
  }; 
   accessDetails.AccessRules = folderRule; 
   accessDetails.Role = "Document Manager"; 
  return accessDetails; 
} 
 
For your reference, we have prepared a sample with access control functionality in FileManager component. 
 
 
We have considered update our documentation with more information on Access control support in File Manager in our upcoming release. 
 
Please let us know, if you need any further assistance. 
 
Regards, 
Shameer Ali Baig S. 


Loader.
Live Chat Icon For mobile
Up arrow icon