Esempio n. 1
0
 internal static bool CanEdit(IFolderInfo folder)
 {
     if (folder == null)
     {
         return(false);
     }
     return(FolderPermissionController.CanAddFolder(folder as FolderInfo));
 }
        public virtual bool CanAddToFolder(FolderInfo dnnFolder)
        {
            if (!FolderPermissionController.CanAddFolder(dnnFolder))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        public override bool CanEditFolder(IAsset item)
        {
            var id = (item as IFolder)?.Id
                     ?? (item as IFile)?.ParentId
                     ?? throw new ArgumentException("Should be a DNN asset", nameof(item));

            var folder = FolderManager.Instance.GetFolder(id);

            return(folder != null && FolderPermissionController.CanAddFolder(folder as FolderInfo));
        }
Esempio n. 4
0
        private string Check_CanAddToFolder(FolderInfo dnnFolder, bool isFileCheck, bool logDetail)
        {
            if (dnnFolder == null)
            {
                return(LogDetailError(ErrorCodes.FolderDoesNotExist, ToVirtualPath(dnnFolder.FolderPath), logDetail));
            }

            //check permissions
            if (!(FolderPermissionController.CanAddFolder(dnnFolder)))
            {
                return(LogDetailError(ErrorCodes.AddFolder_NoPermission, ToVirtualPath(dnnFolder.FolderPath), logDetail));
            }

            return(string.Empty);
        }
        public static PathPermissions TelerikPermissions(IFolderInfo folder)
        {
            var folderPermissions = PathPermissions.Read;

            if (FolderPermissionController.CanViewFolder((FolderInfo)folder))
            {
                if (FolderPermissionController.CanAddFolder((FolderInfo)folder))
                {
                    folderPermissions = folderPermissions | PathPermissions.Upload;
                }

                if (FolderPermissionController.CanDeleteFolder((FolderInfo)folder))
                {
                    folderPermissions = folderPermissions | PathPermissions.Delete;
                }
            }

            return(folderPermissions);
        }
Esempio n. 6
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// This routine populates the Folder List Drop Down
        /// There is no reference to permissions here as all folders should be available to the admin.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [Philip Beadle]     5/10/2004  Added
        ///     [cnurse]            04/24/2006  Converted to use Database as folder source
        /// </history>
        /// -----------------------------------------------------------------------------
        private void LoadFolders()
        {
            ddlFolders.Items.Clear();

            var user = UserController.GetCurrentUserInfo();

            var folders = FolderManager.Instance.GetFolders(FolderPortalID, "ADD", user.UserID);

            foreach (FolderInfo folder in folders)
            {
                if (FolderPermissionController.CanAddFolder(folder))
                {
                    var FolderItem = new ListItem();
                    if (folder.FolderPath == Null.NullString)
                    {
                        if (IsHostMenu)
                        {
                            FolderItem.Text = Localization.GetString("HostRoot", LocalResourceFile);
                        }
                        else
                        {
                            FolderItem.Text = Localization.GetString("PortalRoot", LocalResourceFile);
                        }
                    }
                    else
                    {
                        FolderItem.Text = PathUtils.Instance.RemoveTrailingSlash(folder.DisplayPath);
                    }
                    FolderItem.Value = folder.FolderPath;
                    ddlFolders.AddItem(FolderItem.Text, FolderItem.Value);
                }
            }

            if (!String.IsNullOrEmpty(DestinationFolder))
            {
                if (ddlFolders.FindItemByText(DestinationFolder) != null)
                {
                    ddlFolders.FindItemByText(DestinationFolder).Selected = true;
                }
            }
        }
Esempio n. 7
0
 internal static bool CanEdit(IFolderInfo folder)
 => folder != null && FolderPermissionController.CanAddFolder(folder as FolderInfo);
 public bool CanAddFolder(IFolderInfo folder)
 {
     return(FolderPermissionController.CanAddFolder((FolderInfo)folder));
 }