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

How to permission files and folders separately?

5 Answers 145 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 23 Sep 2010, 04:49 PM
I have the following permissions set in a table in a database.

1. Create files
2. Delete files
3. Create folders
4. Delete folders
5. Full

I know you can set the permissions for create and delete for folders and files (using code below), but I can't see how to separate them - i.e. enabled only file creation, and not folder creation?

RadFileExplorer1.Configuration.ViewPaths = paths;
RadFileExplorer1.Configuration.UploadPaths = paths;
RadFileExplorer1.Configuration.DeletePaths = paths;

Do I have to extend the FileSystemContentProvider?  If so, is there some code to help me along my way?  I have looked at http://www.telerik.com/help/aspnet-ajax/radfileexplorer-custom-filebrowsercontentprovider.html but that doesn't really clear things up for me.

Thanks,
Mark

5 Answers, 1 is accepted

Sort by
0
Jed
Top achievements
Rank 1
answered on 24 Sep 2010, 03:58 AM
I would read up these two pages:

http://www.telerik.com/help/aspnet-ajax/radfileexplorer-server-side-programming.html

and

http://www.telerik.com/help/aspnet-ajax/radfileexplorer-client-side.html

you can also do things like:

C#

RadFileExplorer.ToolBar.Items.FindItemByText("Upload").Visible = false;
RadFileExplorer.GridContextMenu.FindItemByText("Upload").Visible = false;
RadFileExplorer.TreeView.ContextMenus[0].FindItemByText("Upload").Visible = false;

JavaScript

function OnClientFolderChange(fileExplorer, args) {
     var toolbar = fileExplorer.get_toolbar();
     var tbModify = toolbar.findItemByValue("Upload");
     tbModify.hide(); // hide the upload button
}


0
Mark
Top achievements
Rank 1
answered on 28 Sep 2010, 11:29 AM
Thanks, but RadFileExplorer.ToolBar.Items.FindItemByText("Upload").Visible = false; only works for Upload.  Neither of the other buttons seem to use the text property.  How would I disabled the other toolbar buttons?
0
Fiko
Telerik team
answered on 28 Sep 2010, 04:30 PM
Hello Mark,

I believe that this KB article will be of help.


Regards,
Fiko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 28 Sep 2010, 06:50 PM
Thanks Fiko.  That is what I am after.  However, this covers deleting an item - how do I add an item back into the collection once it has been removed?

For my requirements I need to remove all the items from the toolbar by looping through the ToolBar.Items collection, then check which permission the user should have, and then add back in the relevant items. 

At the moment I have this working by looping through the ToolBar.Items collection and hiding the items using CSS display:none, and then looping through the collection and only showing the applicable items based on the user's permissions.  However, I would like to remove the items rather than just hiding them.

Thanks,
Mark
0
Fiko
Telerik team
answered on 01 Oct 2010, 11:15 AM
Hi Mark,

In your case I recommend you to first hide the RadToolBar's items by setting their Visible="false" properties and then enable those you want by setting their Visible properties to "true".

Regards,
Fiko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
FileExplorer
Asked by
Mark
Top achievements
Rank 1
Answers by
Jed
Top achievements
Rank 1
Mark
Top achievements
Rank 1
Fiko
Telerik team
Share this question
or