Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesFolder security / PermissionsFolder security / Permissions
Previous
 
Next
New Post
9/25/2011 9:08 AM
 
High,

in a module I am creating a folder for uploaded files. How can I check if "All users" have write permissions on that folder and assign these permissions if necessary? (DNN 5 + DNN 6, if there are any differences)

Thanks for your help,
Michael

Michael Tobisch
DNN★MVP

dnn-Connect.org - The most vibrant community around the DNN-platform
 
New Post
9/25/2011 9:07 PM
 
i dont have the code in front of my at the moment, but as far as I remember you just call FolderPermissionCollection.GetFolderPermissionsCollectionByFolder to get the permissions and check for your role(s) and call SaveFolderPermissions to apply any needed changes - if you take a look at the filemanager code you show see this (desktopmodules/admin/filemanager/filemanager.ascx.vb AFAIR)

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
9/27/2011 1:50 PM
 

Cathal,

thanks for your answer, but this did not really work. What I found out was the following:

01.string folder = String.Format("{0}myUploadFolder", base.PortalSettings.HomeDirectoryMapPath);
02.if (!(Directory.Exists(folder)))
03.{
04.   FileSystemUtils.AddFolder(base.PortalSettings, base.PortalSettings.HomeDirectoryMapPath, "myUploadFolder", Convert.ToInt32(FolderController.StorageLocationTypes.InsecureFileSystem));
05.}
06.FolderInfo fi = FileSystemUtils.GetFolder(base.PortalId, "myUploadFolder");
07. 
08.if (fi == null)
09.   FileSystemUtils.SynchronizeFolder(base.PortalId, folder, "myUploadFolder", false, true, true, true);
10. 
11.FolderPermissionCollection folderPermissions = fi.FolderPermissions;
12.if (!(FolderPermissionController.HasFolderPermission(folderPermissions, "Write")))
13.{
14.   PermissionController permissionController = new PermissionController();
15.   ArrayList arr = permissionController.GetPermissionByCodeAndKey("SYSTEM_FOLDER", "WRITE");
16. 
17.   FolderPermissionInfo folderPermission = new FolderPermissionInfo();
18.   folderPermission.RoleID = -1;
19.   folderPermission.PermissionID = 6;
20.   folderPermission.AllowAccess = true;
21. 
22.   folderPermissions.Add(folderPermission);
23.   FolderPermissionController.SaveFolderPermissions(fi);
24.}

When there is any "WRITE" permission on the folder (allowed or denied) for All Users, an exception is fired that there is already a permission defined.

When no permission is set, the permission will be set, but the file is not uploaded. After I log in as Administrator, I see the permission. I log out and try again - and it works.

Any idea?

Best wishes
Michael

Michael Tobisch
DNN★MVP

dnn-Connect.org - The most vibrant community around the DNN-platform
 
New Post
9/27/2011 2:30 PM
 
This could be related (or maybe not..): http://support.dotnetnuke.com/issue/V... ("file manager - misisng permissions when creating folder(s) from sync operation")
This was submitted on 8/31/2011. Still not verified, not comment, no nothing. 
 
New Post
9/27/2011 3:11 PM
 
Horacio,

that was exactly what I found out. After changing the folder Permissions, I had to synchronoize the folder explicitely, and now it works.

Best wishes,
and thanks for your help, Horacio and Cathal

Michael

Michael Tobisch
DNN★MVP

dnn-Connect.org - The most vibrant community around the DNN-platform
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesFolder security / PermissionsFolder security / Permissions


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out