private string Check_CanDeleteFolder(string virtualPath, bool isFileCheck, bool logDetail)
        {
            var dnnFolder = GetDNNFolder(virtualPath);

            if (dnnFolder == null)
            {
                return(LogDetailError(ErrorCodes.FolderDoesNotExist, virtualPath, logDetail));
            }

            //skip additional folder checks when it is a file
            if (!isFileCheck)
            {
                //Don't allow delete of root folder, root is a protected folder, but show a special message
                if (dnnFolder.FolderPath == DBHomeDirectory)
                {
                    return(LogDetailError(ErrorCodes.DeleteFolder_Root, ToVirtualPath(dnnFolder.FolderPath)));
                }

                //Don't allow deleting of any protected folder
                if (dnnFolder.IsProtected)
                {
                    return(LogDetailError(ErrorCodes.DeleteFolder_Protected, ToVirtualPath(dnnFolder.FolderPath), logDetail));
                }
            }

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

            return(string.Empty);
        }
        public virtual bool CanDeleteFolder(FolderInfo dnnFolder)
        {
            if (!(FolderPermissionController.CanDeleteFolder(dnnFolder)))
            {
                return(false);
            }

            return(true);
        }
Пример #3
0
        /// <inheritdoc/>
        public bool HasDeletePermission(int moduleMode, int folderId)
        {
            if (!this.HasGroupFolderOwnerPermission(folderId))
            {
                return(false);
            }

            if (moduleMode == (int)Constants.ModuleModes.User && !this.IsUserFolder(folderId))
            {
                return(false);
            }

            var folder = this.folderManager.GetFolder(folderId);

            return(FolderPermissionController.CanDeleteFolder((FolderInfo)folder));
        }
        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);
        }