Custom Permission on folders

2 posts, 0 answers
  1. Sheepdog
    Sheepdog avatar
    72 posts
    Member since:
    Nov 2005

    Posted 02 Feb 2010 Link to this post

    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.


  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 08 Feb 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top