This is a migrated thread and some comments may be shown as answers.

Custom Permission on folders

1 Answer 106 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Sheepdog
Top achievements
Rank 1
Sheepdog asked on 02 Feb 2010, 08:14 PM
I want to use the FileExplorer control to display files and folders to my users.

I have a shared network Folder that I want to apply this control too, I also have a database of custom security info for each file and folder in the network folders. So because I have custom security, and the data is in the database, and the physical files are on a shared network folder, I have to apply both physical folder manipulation and custom security based on data that corrosponds to the info store in the database. So I figured that I should start by extending the FileSystemContentProvider .

Here is my scenario...

Some users are Admins, and have the ability to Write, Delete, Move, Upload, Copy and Read folders and Files.
Some users are Field Admins and have the ability to Write, Delete, Move, Upload, Copy and Read folders and files Only in certain folders.
And Some users are read only, and cannot have the ability to Write, Delete, Move, Upload and Copy folders and files anywhere, only the ability to read the files and folders.

I have started by extending the FileSystemContentProvider by putting my own security checks in the 

ResolveRootDirectoryAsTree, and ResolveDirectory Overriden functions to display only certain files and certain folders to the user based on their custom security, however this does not prevent Writing, Deleting, Moving, Uploading and copying Folders and files or the context menus.

what I am looking for is a way to enable, and disable the various context menus that would allow the user to Write, Delete, Move, Upload, and copy folders and files based on their custom security. The users security info is stored in custom session variables.


1 Answer, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 08 Feb 2010, 01:22 PM
Hello Sheepdog,

In your case you need to pass the calculated permissions to the constructor of the folders.
DirectoryItem result = new DirectoryItem(PathHelper.GetDirectoryName(physicalPath),
                            string.Empty,
                            virtualPath,
                            string.Empty,
                            GetPermissions(physicalPath),
                            null, // Files are added in the ResolveDirectory method
                            GetDirectories(virtualPath)
                        );

In case that a folder does not have Upload permissions, then the upload command will be disabled automatically for this folder.

I hope this helps.

Kind regards,
Fiko
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
FileExplorer
Asked by
Sheepdog
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Share this question
or