private void cmdCopyPerm_Click(object sender, EventArgs e) { try { FolderPermissionController.CopyPermissionsToSubfolders(this.Folder, this.PermissionsGrid.Permissions); UI.Skins.Skin.AddModuleMessage(this, this.LocalizeString("PermissionsCopied"), ModuleMessage.ModuleMessageType.GreenSuccess); } catch (Exception ex) { UI.Skins.Skin.AddModuleMessage(this, this.LocalizeString("PermissionCopyError"), ModuleMessage.ModuleMessageType.RedError); Exceptions.ProcessModuleLoadException(this, ex); } }
public ActionResult Save(int folderid, bool Copyfolder, dynamic Data) { ActionResult actionResult = new ActionResult(); IFolderInfo parentFolder = FolderManager.Instance.GetFolder(folderid); if (parentFolder != null) { parentFolder.FolderPermissions.Clear(); DotNetNuke.Security.Permissions.PermissionController permController = new DotNetNuke.Security.Permissions.PermissionController(); ArrayList permArray = permController.GetPermissionByCodeAndKey("SYSTEM_FOLDER", "READ"); List <PermissionInfo> SYS_FOLDER_PERM = new List <PermissionInfo>(); if (permArray.Count == 1) { SYS_FOLDER_PERM.Add(permArray[0] as PermissionInfo); } permArray = permController.GetPermissionByCodeAndKey("SYSTEM_FOLDER", "BROWSE"); if (permArray.Count == 1) { SYS_FOLDER_PERM.Add(permArray[0] as PermissionInfo); } permArray = permController.GetPermissionByCodeAndKey("SYSTEM_FOLDER", "WRITE"); if (permArray.Count == 1) { SYS_FOLDER_PERM.Add(permArray[0] as PermissionInfo); } foreach (dynamic item in Data.PermissionsRoles) { foreach (dynamic p in item.Permissions) { bool AllowAcess = bool.Parse(p.AllowAccess.ToString()); string PermissionID = p.PermissionId.ToString(); if (AllowAcess) { FolderPermissionInfo folderpermissioninfo = new FolderPermissionInfo { AllowAccess = AllowAcess, PermissionID = Convert.ToInt32(PermissionID) }; PermissionInfo SYS_PERM = SYS_FOLDER_PERM.Where(a => a.PermissionID == folderpermissioninfo.PermissionID).FirstOrDefault(); if (SYS_PERM != null) { folderpermissioninfo.PermissionKey = SYS_PERM.PermissionKey; } folderpermissioninfo.RoleID = int.Parse(item.RoleId.ToString()); parentFolder.FolderPermissions.Add(folderpermissioninfo); } } } foreach (dynamic item in Data.PermissionsUsers) { foreach (dynamic p in item.Permissions) { bool AllowAcess = bool.Parse(p.AllowAccess.ToString()); string PermissionID = p.PermissionId.ToString(); if (AllowAcess) { FolderPermissionInfo folderpermissioninfo = new FolderPermissionInfo { AllowAccess = AllowAcess, PermissionID = Convert.ToInt32(PermissionID) }; PermissionInfo SYS_PERM = SYS_FOLDER_PERM.Where(a => a.PermissionID == folderpermissioninfo.PermissionID).FirstOrDefault(); if (SYS_PERM != null) { folderpermissioninfo.PermissionKey = SYS_PERM.PermissionKey; } folderpermissioninfo.UserID = int.Parse(item.UserId.ToString()); parentFolder.FolderPermissions.Add(folderpermissioninfo); } } } FolderManager.Instance.UpdateFolder(parentFolder); if (Copyfolder) { FolderPermissionController.CopyPermissionsToSubfolders(parentFolder, parentFolder.FolderPermissions); } } Dictionary <int, bool> result = new Dictionary <int, bool>(); if (Data != null && Data.FolderIds != null && Data.FolderIds.Count > 0) { foreach (dynamic id in Data.FolderIds) { result.Add(int.Parse(id.Value), BrowseUploadFactory.HasBrowseOpenPerm(new Vanjaro.Common.Components.TreeView() { Value = int.Parse(id.Value) })); } } actionResult.Data = result; return(actionResult); }