FIxes authz on some controllers, fixes js var paths for login providers, simplifies gulp so we aren't building 2x.
This commit is contained in:
@@ -133,6 +133,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
// TODO: We need to move this since we are going to delete OverrideAuthorization
|
||||
[UmbracoBackOfficeAuthorize, OverrideAuthorization]
|
||||
public bool AllowsCultureVariation()
|
||||
{
|
||||
|
||||
@@ -5,14 +5,12 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Dictionary;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
@@ -31,7 +29,6 @@ using Umbraco.Web.BackOffice.Filters;
|
||||
using Umbraco.Web.Common.Attributes;
|
||||
using Umbraco.Web.Common.Exceptions;
|
||||
using Umbraco.Web.Editors;
|
||||
using Umbraco.Web.Security;
|
||||
using ContentType = Umbraco.Core.Models.ContentType;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
@@ -39,18 +36,15 @@ using Umbraco.Core.Serialization;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.Controllers
|
||||
{
|
||||
// TODO: We'll need to be careful about the security on this controller, when we start implementing
|
||||
// methods to modify content types we'll need to enforce security on the individual methods, we
|
||||
// cannot put security on the whole controller because things like
|
||||
// GetAllowedChildren, GetPropertyTypeScaffold, GetAllPropertyTypeAliases are required for content editing.
|
||||
|
||||
/// <summary>
|
||||
/// An API controller used for dealing with content types
|
||||
/// </summary>
|
||||
[PluginController(Constants.Web.Mvc.BackOfficeApiArea)]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
[PluginController(Constants.Web.Mvc.BackOfficeApiArea)]
|
||||
public class ContentTypeController : ContentTypeControllerBase<IContentType>
|
||||
{
|
||||
// TODO: Split this controller apart so that authz is consistent, currently we need to authz each action individually.
|
||||
// It would be possible to have something like a ContentTypeInfoController for the GetAllPropertyTypeAliases/GetCount/GetAllowedChildren/etc... actions
|
||||
|
||||
private readonly IEntityXmlSerializer _serializer;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly PropertyEditorCollection _propertyEditors;
|
||||
@@ -130,6 +124,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
_jsonSerializer = jsonSerializer;
|
||||
}
|
||||
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public int GetCount()
|
||||
{
|
||||
return _contentTypeService.Count();
|
||||
@@ -148,6 +143,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[DetermineAmbiguousActionByPassingParameters]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public DocumentTypeDisplay GetById(int id)
|
||||
{
|
||||
var ct = _contentTypeService.Get(id);
|
||||
@@ -166,6 +162,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[DetermineAmbiguousActionByPassingParameters]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public DocumentTypeDisplay GetById(Guid id)
|
||||
{
|
||||
var contentType = _contentTypeService.Get(id);
|
||||
@@ -184,6 +181,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[DetermineAmbiguousActionByPassingParameters]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public DocumentTypeDisplay GetById(Udi id)
|
||||
{
|
||||
var guidUdi = id as GuidUdi;
|
||||
@@ -207,6 +205,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
[HttpPost]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public IActionResult DeleteById(int id)
|
||||
{
|
||||
var foundType = _contentTypeService.Get(id);
|
||||
@@ -253,6 +252,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// <param name="filter"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public IActionResult GetAvailableCompositeContentTypes(GetAvailableCompositionsFilter filter)
|
||||
{
|
||||
var result = PerformGetAvailableCompositeContentTypes(filter.ContentTypeId, UmbracoObjectTypes.DocumentType, filter.FilterContentTypes, filter.FilterPropertyTypes, filter.IsElement)
|
||||
@@ -270,6 +270,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// <param name="filter"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public IActionResult GetWhereCompositionIsUsedInContentTypes(GetAvailableCompositionsFilter filter)
|
||||
{
|
||||
var result = PerformGetWhereCompositionIsUsedInContentTypes(filter.ContentTypeId, UmbracoObjectTypes.DocumentType)
|
||||
@@ -312,6 +313,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
[HttpPost]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public IActionResult DeleteContainer(int id)
|
||||
{
|
||||
_contentTypeService.DeleteContainer(id, _backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.Id);
|
||||
@@ -319,6 +321,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public IActionResult PostCreateContainer(int parentId, string name)
|
||||
{
|
||||
var result = _contentTypeService.CreateContainer(parentId, name, _backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.Id);
|
||||
@@ -328,6 +331,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
: throw HttpResponseException.CreateNotificationValidationErrorResponse(result.Exception.Message);
|
||||
}
|
||||
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public IActionResult PostRenameContainer(int id, string name)
|
||||
{
|
||||
var result = _contentTypeService.RenameContainer(id, name, _backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.Id);
|
||||
@@ -337,6 +341,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
: throw HttpResponseException.CreateNotificationValidationErrorResponse(result.Exception.Message);
|
||||
}
|
||||
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public CreatedContentTypeCollectionResult PostCreateCollection(int parentId, string collectionName, bool collectionCreateTemplate, string collectionItemName, bool collectionItemCreateTemplate, string collectionIcon, string collectionItemIcon)
|
||||
{
|
||||
// create item doctype
|
||||
@@ -393,6 +398,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
};
|
||||
}
|
||||
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public DocumentTypeDisplay PostSave(DocumentTypeSave contentTypeSave)
|
||||
{
|
||||
//Before we send this model into this saving/mapping pipeline, we need to do some cleanup on variations.
|
||||
@@ -445,6 +451,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
return display;
|
||||
}
|
||||
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public ActionResult<TemplateDisplay> PostCreateDefaultTemplate(int id)
|
||||
{
|
||||
var contentType = _contentTypeService.Get(id);
|
||||
@@ -485,6 +492,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// </summary>
|
||||
/// <param name="parentId"></param>
|
||||
/// <returns></returns>
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public DocumentTypeDisplay GetEmpty(int parentId)
|
||||
{
|
||||
IContentType ct;
|
||||
@@ -506,6 +514,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// <summary>
|
||||
/// Returns all content type objects
|
||||
/// </summary>
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public IEnumerable<ContentTypeBasic> GetAll()
|
||||
{
|
||||
var types = _contentTypeService.GetAll();
|
||||
@@ -578,6 +587,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// </summary>
|
||||
/// <param name="move"></param>
|
||||
/// <returns></returns>
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public IActionResult PostMove(MoveOrCopy move)
|
||||
{
|
||||
return PerformMove(
|
||||
@@ -591,6 +601,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// </summary>
|
||||
/// <param name="copy"></param>
|
||||
/// <returns></returns>
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public IActionResult PostCopy(MoveOrCopy copy)
|
||||
{
|
||||
return PerformCopy(
|
||||
@@ -600,6 +611,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public IActionResult Export(int id)
|
||||
{
|
||||
var contentType = _contentTypeService.Get(id);
|
||||
@@ -616,6 +628,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public IActionResult Import(string file)
|
||||
{
|
||||
var filePath = Path.Combine(_ioHelper.MapPath(Core.Constants.SystemDirectories.Data), file);
|
||||
@@ -648,7 +661,8 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<ContentTypeImportModel>> Upload(List<IFormFile> file)
|
||||
[UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)]
|
||||
public ActionResult<ContentTypeImportModel> Upload(List<IFormFile> file)
|
||||
{
|
||||
var model = new ContentTypeImportModel();
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ using Umbraco.Core.Mapping;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Extensions;
|
||||
using Umbraco.Web.BackOffice.Filters;
|
||||
using Umbraco.Web.Common.Attributes;
|
||||
using Umbraco.Web.Common.Exceptions;
|
||||
using Umbraco.Web.Editors;
|
||||
@@ -26,7 +27,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// Am abstract API controller providing functionality used for dealing with content and media types
|
||||
/// </summary>
|
||||
[PluginController(Constants.Web.Mvc.BackOfficeApiArea)]
|
||||
//[PrefixlessBodyModelValidator] //TODO reintroduce
|
||||
[PrefixlessBodyModelValidator]
|
||||
public abstract class ContentTypeControllerBase<TContentType> : UmbracoAuthorizedJsonController
|
||||
where TContentType : class, IContentTypeComposition
|
||||
{
|
||||
|
||||
@@ -15,21 +15,18 @@ using Umbraco.Web.Common.Attributes;
|
||||
using Umbraco.Web.Common.Exceptions;
|
||||
using Umbraco.Web.Editors;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Security;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.Controllers
|
||||
{
|
||||
// TODO: We'll need to be careful about the security on this controller, when we start implementing
|
||||
// methods to modify content types we'll need to enforce security on the individual methods, we
|
||||
// cannot put security on the whole controller because things like GetAllowedChildren are required for content editing.
|
||||
|
||||
/// <summary>
|
||||
/// An API controller used for dealing with content types
|
||||
/// An API controller used for dealing with content types
|
||||
/// </summary>
|
||||
[PluginController(Constants.Web.Mvc.BackOfficeApiArea)]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
|
||||
public class MediaTypeController : ContentTypeControllerBase<IMediaType>
|
||||
{
|
||||
// TODO: Split this controller apart so that authz is consistent, currently we need to authz each action individually.
|
||||
// It would be possible to have something like a MediaTypeInfoController for the GetById/GetAllowedChildren/etc... actions
|
||||
|
||||
private readonly IContentTypeService _contentTypeService;
|
||||
private readonly IEntityService _entityService;
|
||||
private readonly ILocalizedTextService _localizedTextService;
|
||||
@@ -140,6 +137,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
[HttpPost]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
|
||||
public IActionResult DeleteById(int id)
|
||||
{
|
||||
var foundType = _mediaTypeService.Get(id);
|
||||
@@ -175,6 +173,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
|
||||
public IActionResult GetAvailableCompositeMediaTypes(GetAvailableCompositionsFilter filter)
|
||||
{
|
||||
var result = PerformGetAvailableCompositeContentTypes(filter.ContentTypeId, UmbracoObjectTypes.MediaType,
|
||||
@@ -195,6 +194,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
/// <param name="filter"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
|
||||
public IActionResult GetWhereCompositionIsUsedInContentTypes(GetAvailableCompositionsFilter filter)
|
||||
{
|
||||
var result =
|
||||
@@ -206,6 +206,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
|
||||
public MediaTypeDisplay GetEmpty(int parentId)
|
||||
{
|
||||
IMediaType mt;
|
||||
@@ -227,19 +228,21 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns all media types
|
||||
/// Returns all media types
|
||||
/// </summary>
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
|
||||
public IEnumerable<ContentTypeBasic> GetAll() =>
|
||||
_mediaTypeService.GetAll()
|
||||
.Select(_umbracoMapper.Map<IMediaType, ContentTypeBasic>);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a media type container with a given ID
|
||||
/// Deletes a media type container with a given ID
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
[HttpPost]
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
|
||||
public IActionResult DeleteContainer(int id)
|
||||
{
|
||||
_mediaTypeService.DeleteContainer(id, _backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.Id);
|
||||
@@ -247,6 +250,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
|
||||
public IActionResult PostCreateContainer(int parentId, string name)
|
||||
{
|
||||
var result = _mediaTypeService.CreateContainer(parentId, name, _backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.Id);
|
||||
@@ -256,6 +260,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
: throw HttpResponseException.CreateNotificationValidationErrorResponse(result.Exception.Message);
|
||||
}
|
||||
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
|
||||
public IActionResult PostRenameContainer(int id, string name)
|
||||
{
|
||||
var result = _mediaTypeService.RenameContainer(id, name, _backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.Id);
|
||||
@@ -265,6 +270,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
: throw HttpResponseException.CreateNotificationValidationErrorResponse(result.Exception.Message);
|
||||
}
|
||||
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
|
||||
public MediaTypeDisplay PostSave(MediaTypeSave contentTypeSave)
|
||||
{
|
||||
var savedCt = PerformPostSave<MediaTypeDisplay, MediaTypeSave, PropertyTypeBasic>(
|
||||
@@ -282,10 +288,11 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move the media type
|
||||
/// Move the media type
|
||||
/// </summary>
|
||||
/// <param name="move"></param>
|
||||
/// <returns></returns>
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
|
||||
public IActionResult PostMove(MoveOrCopy move)
|
||||
{
|
||||
return PerformMove(
|
||||
@@ -295,10 +302,11 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copy the media type
|
||||
/// Copy the media type
|
||||
/// </summary>
|
||||
/// <param name="copy"></param>
|
||||
/// <returns></returns>
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes)]
|
||||
public IActionResult PostCopy(MoveOrCopy copy)
|
||||
{
|
||||
return PerformCopy(
|
||||
@@ -311,7 +319,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
#region GetAllowedChildren
|
||||
|
||||
/// <summary>
|
||||
/// Returns the allowed child content type objects for the content item id passed in - based on an INT id
|
||||
/// Returns the allowed child content type objects for the content item id passed in - based on an INT id
|
||||
/// </summary>
|
||||
/// <param name="contentId"></param>
|
||||
[UmbracoTreeAuthorize(Constants.Trees.MediaTypes, Constants.Trees.Media)]
|
||||
|
||||
@@ -3,12 +3,13 @@ using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.Filters
|
||||
{
|
||||
// TODO: This should probably be deleted, anything requiring this should move to a different controller
|
||||
public class OverrideAuthorizationAttribute : ActionFilterAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Ensures a special type of authorization filter is ignored. Defaults to <see cref="IAuthorizationFilter"/>.
|
||||
/// </summary>
|
||||
/// <param name="type">The type of authorication filter to override. if null then <see cref="IAuthorizationFilter"/> is used.</param>
|
||||
/// <param name="type">The type of authorization filter to override. if null then <see cref="IAuthorizationFilter"/> is used.</param>
|
||||
/// <remarks>
|
||||
/// https://stackoverflow.com/questions/33558095/overrideauthorizationattribute-in-asp-net-5
|
||||
/// </remarks>
|
||||
|
||||
@@ -4,6 +4,7 @@ using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.Filters
|
||||
{
|
||||
// TODO: This should probably be deleted, anything requiring this should move to a different controller
|
||||
public class OverrideAuthorizationFilterProvider : IFilterProvider, IFilterMetadata
|
||||
{
|
||||
public void OnProvidersExecuted(FilterProviderContext context)
|
||||
|
||||
@@ -78,7 +78,7 @@ module.exports = {
|
||||
assets: "./src/assets/**"
|
||||
}
|
||||
},
|
||||
roots: ["../Umbraco.Web.UI/", "../Umbraco.Web.UI.NetCore/wwwroot/"],
|
||||
root: "../Umbraco.Web.UI.NetCore/wwwroot/",
|
||||
targets: {
|
||||
js: "umbraco/js/",
|
||||
lib: "umbraco/lib/",
|
||||
|
||||
@@ -21,7 +21,7 @@ function dependencies() {
|
||||
const nodeModules = [
|
||||
{
|
||||
"name": "ace-builds",
|
||||
"src": [
|
||||
"src": [
|
||||
"./node_modules/ace-builds/src-min-noconflict/ace.js",
|
||||
"./node_modules/ace-builds/src-min-noconflict/ext-language_tools.js",
|
||||
"./node_modules/ace-builds/src-min-noconflict/ext-searchbox.js",
|
||||
@@ -43,23 +43,23 @@ function dependencies() {
|
||||
},
|
||||
{
|
||||
"name": "angular",
|
||||
"src": ["./node_modules/angular/angular.js"],
|
||||
"src": ["./node_modules/angular/angular.js"],
|
||||
"base": "./node_modules/angular"
|
||||
},
|
||||
{
|
||||
"name": "angular-aria",
|
||||
"src": ["./node_modules/angular-aria/angular-aria.min.js",
|
||||
"./node_modules/angular-aria/angular-aria.min.js.map"],
|
||||
"src": ["./node_modules/angular-aria/angular-aria.min.js",
|
||||
"./node_modules/angular-aria/angular-aria.min.js.map"],
|
||||
"base": "./node_modules/angular-aria"
|
||||
},
|
||||
{
|
||||
"name": "angular-cookies",
|
||||
"src": ["./node_modules/angular-cookies/angular-cookies.js"],
|
||||
"src": ["./node_modules/angular-cookies/angular-cookies.js"],
|
||||
"base": "./node_modules/angular-cookies"
|
||||
},
|
||||
{
|
||||
"name": "angular-dynamic-locale",
|
||||
"src": [
|
||||
"src": [
|
||||
"./node_modules/angular-dynamic-locale/dist/tmhDynamicLocale.min.js",
|
||||
"./node_modules/angular-dynamic-locale/dist/tmhDynamicLocale.min.js.map"
|
||||
],
|
||||
@@ -67,32 +67,32 @@ function dependencies() {
|
||||
},
|
||||
{
|
||||
"name": "angular-sanitize",
|
||||
"src": ["./node_modules/angular-sanitize/angular-sanitize.js"],
|
||||
"src": ["./node_modules/angular-sanitize/angular-sanitize.js"],
|
||||
"base": "./node_modules/angular-sanitize"
|
||||
},
|
||||
{
|
||||
"name": "angular-touch",
|
||||
"src": ["./node_modules/angular-touch/angular-touch.js"],
|
||||
"src": ["./node_modules/angular-touch/angular-touch.js"],
|
||||
"base": "./node_modules/angular-touch"
|
||||
},
|
||||
{
|
||||
"name": "angular-ui-sortable",
|
||||
"src": ["./node_modules/angular-ui-sortable/dist/sortable.js"],
|
||||
"src": ["./node_modules/angular-ui-sortable/dist/sortable.js"],
|
||||
"base": "./node_modules/angular-ui-sortable/dist"
|
||||
},
|
||||
{
|
||||
"name": "angular-route",
|
||||
"src": ["./node_modules/angular-route/angular-route.js"],
|
||||
"src": ["./node_modules/angular-route/angular-route.js"],
|
||||
"base": "./node_modules/angular-route"
|
||||
},
|
||||
{
|
||||
"name": "angular-animate",
|
||||
"src": ["./node_modules/angular-animate/angular-animate.js"],
|
||||
"src": ["./node_modules/angular-animate/angular-animate.js"],
|
||||
"base": "./node_modules/angular-animate"
|
||||
},
|
||||
{
|
||||
"name": "angular-i18n",
|
||||
"src": [
|
||||
"src": [
|
||||
"./node_modules/angular-i18n/angular-i18n.js",
|
||||
"./node_modules/angular-i18n/angular-locale_*.js"
|
||||
],
|
||||
@@ -100,7 +100,7 @@ function dependencies() {
|
||||
},
|
||||
{
|
||||
"name": "angular-local-storage",
|
||||
"src": [
|
||||
"src": [
|
||||
"./node_modules/angular-local-storage/dist/angular-local-storage.min.js",
|
||||
"./node_modules/angular-local-storage/dist/angular-local-storage.min.js.map"
|
||||
],
|
||||
@@ -108,48 +108,48 @@ function dependencies() {
|
||||
},
|
||||
{
|
||||
"name": "angular-messages",
|
||||
"src": ["./node_modules/angular-messages/angular-messages.js"],
|
||||
"src": ["./node_modules/angular-messages/angular-messages.js"],
|
||||
"base": "./node_modules/angular-messages"
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "angular-mocks",
|
||||
"src": ["./node_modules/angular-mocks/angular-mocks.js"],
|
||||
"src": ["./node_modules/angular-mocks/angular-mocks.js"],
|
||||
"base": "./node_modules/angular-mocks"
|
||||
},
|
||||
{
|
||||
"name": "animejs",
|
||||
"src": ["./node_modules/animejs/anime.min.js"],
|
||||
"src": ["./node_modules/animejs/anime.min.js"],
|
||||
"base": "./node_modules/animejs"
|
||||
},
|
||||
{
|
||||
"name": "bootstrap-social",
|
||||
"src": ["./node_modules/bootstrap-social/bootstrap-social.css"],
|
||||
"src": ["./node_modules/bootstrap-social/bootstrap-social.css"],
|
||||
"base": "./node_modules/bootstrap-social"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "angular-chart.js",
|
||||
"src": ["./node_modules/angular-chart.js/dist/angular-chart.min.js"],
|
||||
"src": ["./node_modules/angular-chart.js/dist/angular-chart.min.js"],
|
||||
"base": "./node_modules/angular-chart.js/dist"
|
||||
},
|
||||
{
|
||||
"name": "chart.js",
|
||||
"src": ["./node_modules/chart.js/dist/Chart.min.js"],
|
||||
"src": ["./node_modules/chart.js/dist/Chart.min.js"],
|
||||
"base": "./node_modules/chart.js/dist"
|
||||
},
|
||||
{
|
||||
"name": "clipboard",
|
||||
"src": ["./node_modules/clipboard/dist/clipboard.min.js"],
|
||||
"src": ["./node_modules/clipboard/dist/clipboard.min.js"],
|
||||
"base": "./node_modules/clipboard/dist"
|
||||
},
|
||||
{
|
||||
"name": "jsdiff",
|
||||
"src": ["./node_modules/diff/dist/diff.min.js"],
|
||||
"src": ["./node_modules/diff/dist/diff.min.js"],
|
||||
"base": "./node_modules/diff/dist"
|
||||
},
|
||||
{
|
||||
"name": "flatpickr",
|
||||
"src": [
|
||||
"src": [
|
||||
"./node_modules/flatpickr/dist/flatpickr.js",
|
||||
"./node_modules/flatpickr/dist/flatpickr.css",
|
||||
"./node_modules/flatpickr/dist/l10n/*.js"
|
||||
@@ -158,7 +158,7 @@ function dependencies() {
|
||||
},
|
||||
{
|
||||
"name": "font-awesome",
|
||||
"src": [
|
||||
"src": [
|
||||
"./node_modules/font-awesome/fonts/*",
|
||||
"./node_modules/font-awesome/css/font-awesome.min.css"
|
||||
],
|
||||
@@ -166,7 +166,7 @@ function dependencies() {
|
||||
},
|
||||
{
|
||||
"name": "jquery",
|
||||
"src": [
|
||||
"src": [
|
||||
"./node_modules/jquery/dist/jquery.min.js",
|
||||
"./node_modules/jquery/dist/jquery.min.map"
|
||||
],
|
||||
@@ -174,37 +174,37 @@ function dependencies() {
|
||||
},
|
||||
{
|
||||
"name": "jquery-ui",
|
||||
"src": ["./node_modules/jquery-ui-dist/jquery-ui.min.js"],
|
||||
"src": ["./node_modules/jquery-ui-dist/jquery-ui.min.js"],
|
||||
"base": "./node_modules/jquery-ui-dist"
|
||||
},
|
||||
{
|
||||
"name": "jquery-ui-touch-punch",
|
||||
"src": ["./node_modules/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"],
|
||||
"src": ["./node_modules/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"],
|
||||
"base": "./node_modules/jquery-ui-touch-punch"
|
||||
},
|
||||
{
|
||||
"name": "lazyload-js",
|
||||
"src": ["./node_modules/lazyload-js/LazyLoad.min.js"],
|
||||
"src": ["./node_modules/lazyload-js/LazyLoad.min.js"],
|
||||
"base": "./node_modules/lazyload-js"
|
||||
},
|
||||
{
|
||||
"name": "moment",
|
||||
"src": ["./node_modules/moment/min/moment.min.js"],
|
||||
"src": ["./node_modules/moment/min/moment.min.js"],
|
||||
"base": "./node_modules/moment/min"
|
||||
},
|
||||
{
|
||||
"name": "moment",
|
||||
"src": ["./node_modules/moment/locale/*.js"],
|
||||
"src": ["./node_modules/moment/locale/*.js"],
|
||||
"base": "./node_modules/moment/locale"
|
||||
},
|
||||
{
|
||||
"name": "ng-file-upload",
|
||||
"src": ["./node_modules/ng-file-upload/dist/ng-file-upload.min.js"],
|
||||
"src": ["./node_modules/ng-file-upload/dist/ng-file-upload.min.js"],
|
||||
"base": "./node_modules/ng-file-upload/dist"
|
||||
},
|
||||
{
|
||||
"name": "nouislider",
|
||||
"src": [
|
||||
"src": [
|
||||
"./node_modules/nouislider/distribute/nouislider.min.js",
|
||||
"./node_modules/nouislider/distribute/nouislider.min.css"
|
||||
],
|
||||
@@ -212,14 +212,14 @@ function dependencies() {
|
||||
},
|
||||
{
|
||||
"name": "signalr",
|
||||
"src": [
|
||||
"src": [
|
||||
"./node_modules/@microsoft/signalr/dist/browser/signalr.min.js",
|
||||
],
|
||||
"base": "./node_modules/@microsoft/signalr/dist/browser"
|
||||
},
|
||||
{
|
||||
"name": "spectrum",
|
||||
"src": [
|
||||
"src": [
|
||||
"./node_modules/spectrum-colorpicker2/dist/spectrum.js",
|
||||
"./node_modules/spectrum-colorpicker2/dist/spectrum.css"
|
||||
],
|
||||
@@ -227,7 +227,7 @@ function dependencies() {
|
||||
},
|
||||
{
|
||||
"name": "tinymce",
|
||||
"src": [
|
||||
"src": [
|
||||
"./node_modules/tinymce/tinymce.min.js",
|
||||
"./node_modules/tinymce/plugins/**",
|
||||
"./node_modules/tinymce/skins/**",
|
||||
@@ -237,12 +237,12 @@ function dependencies() {
|
||||
},
|
||||
{
|
||||
"name": "typeahead.js",
|
||||
"src": ["./node_modules/typeahead.js/dist/typeahead.bundle.min.js"],
|
||||
"src": ["./node_modules/typeahead.js/dist/typeahead.bundle.min.js"],
|
||||
"base": "./node_modules/typeahead.js/dist"
|
||||
},
|
||||
{
|
||||
"name": "underscore",
|
||||
"src": ["node_modules/underscore/underscore-min.js"],
|
||||
"src": ["node_modules/underscore/underscore-min.js"],
|
||||
"base": "./node_modules/underscore"
|
||||
},
|
||||
{
|
||||
@@ -257,71 +257,58 @@ function dependencies() {
|
||||
|
||||
// add streams for node modules
|
||||
nodeModules.forEach(module => {
|
||||
var task = gulp.src(module.src, { base: module.base, allowEmpty: true });
|
||||
|
||||
_.forEach(config.roots, function(root){
|
||||
task = task.pipe(gulp.dest(root + config.targets.lib + "/" + module.name))
|
||||
});
|
||||
|
||||
stream.add(task);
|
||||
stream.add(
|
||||
gulp.src(module.src,
|
||||
{ base: module.base, allowEmpty: true })
|
||||
.pipe(gulp.dest(config.root + config.targets.lib + "/" + module.name))
|
||||
);
|
||||
});
|
||||
|
||||
//copy over libs which are not on npm (/lib)
|
||||
var libTask = gulp.src(config.sources.globs.lib, { allowEmpty: true });
|
||||
|
||||
_.forEach(config.roots, function(root){
|
||||
libTask = libTask.pipe(gulp.dest(root + config.targets.lib))
|
||||
});
|
||||
|
||||
stream.add(libTask);
|
||||
stream.add(
|
||||
gulp.src(config.sources.globs.lib, { allowEmpty: true })
|
||||
.pipe(gulp.dest(config.root + config.targets.lib))
|
||||
);
|
||||
|
||||
//Copies all static assets into /root / assets folder
|
||||
//css, fonts and image files
|
||||
|
||||
|
||||
var assetsTask = gulp.src(config.sources.globs.assets, { allowEmpty: true });
|
||||
assetsTask = assetsTask.pipe(imagemin([
|
||||
imagemin.gifsicle({interlaced: true}),
|
||||
imagemin.mozjpeg({progressive: true}),
|
||||
imagemin.optipng({optimizationLevel: 5}),
|
||||
imagemin.gifsicle({ interlaced: true }),
|
||||
imagemin.mozjpeg({ progressive: true }),
|
||||
imagemin.optipng({ optimizationLevel: 5 }),
|
||||
imagemin.svgo({
|
||||
plugins: [
|
||||
{removeViewBox: true},
|
||||
{cleanupIDs: false}
|
||||
{ removeViewBox: true },
|
||||
{ cleanupIDs: false }
|
||||
]
|
||||
})
|
||||
]));
|
||||
|
||||
_.forEach(config.roots, function(root){
|
||||
assetsTask = assetsTask.pipe(gulp.dest(root + config.targets.assets));
|
||||
});
|
||||
|
||||
|
||||
assetsTask = assetsTask.pipe(gulp.dest(config.root + config.targets.assets));
|
||||
|
||||
|
||||
stream.add(assetsTask);
|
||||
|
||||
// Copies all the less files related to the preview into their folder
|
||||
//these are not pre-processed as preview has its own less compiler client side
|
||||
var lessTask = gulp.src("src/canvasdesigner/editors/*.less", { allowEmpty: true });
|
||||
stream.add(
|
||||
gulp.src("src/canvasdesigner/editors/*.less", { allowEmpty: true })
|
||||
.pipe(gulp.dest(config.root + config.targets.assets + "/less"))
|
||||
);
|
||||
|
||||
_.forEach(config.roots, function(root){
|
||||
lessTask = lessTask.pipe(gulp.dest(root + config.targets.assets + "/less"));
|
||||
});
|
||||
stream.add(lessTask);
|
||||
// TODO: check if we need these fileSize
|
||||
stream.add(
|
||||
gulp.src("src/views/propertyeditors/grid/config/*.*", { allowEmpty: true })
|
||||
.pipe(gulp.dest(config.root + config.targets.views + "/propertyeditors/grid/config"))
|
||||
);
|
||||
|
||||
stream.add(
|
||||
gulp.src("src/views/dashboard/default/*.jpg", { allowEmpty: true })
|
||||
.pipe(gulp.dest(config.root + config.targets.views + "/dashboard/default"))
|
||||
);
|
||||
|
||||
|
||||
// TODO: check if we need these fileSize
|
||||
var configTask = gulp.src("src/views/propertyeditors/grid/config/*.*", { allowEmpty: true });
|
||||
_.forEach(config.roots, function(root){
|
||||
configTask = configTask.pipe(gulp.dest(root + config.targets.views + "/propertyeditors/grid/config"));
|
||||
});
|
||||
stream.add(configTask);
|
||||
|
||||
var dashboardTask = gulp.src("src/views/dashboard/default/*.jpg", { allowEmpty: true });
|
||||
_.forEach(config.roots, function(root){
|
||||
dashboardTask = dashboardTask .pipe(gulp.dest(root + config.targets.views + "/dashboard/default"));
|
||||
});
|
||||
stream.add(dashboardTask);
|
||||
|
||||
return stream;
|
||||
};
|
||||
|
||||
|
||||
@@ -16,19 +16,17 @@ function js() {
|
||||
//we run multiple streams, so merge them all together
|
||||
var stream = new MergeStream();
|
||||
|
||||
var task = gulp.src(config.sources.globs.js);
|
||||
_.forEach(config.roots, function(root){
|
||||
task = task.pipe( gulp.dest(root + config.targets.js) )
|
||||
})
|
||||
stream.add(task);
|
||||
|
||||
stream.add(
|
||||
gulp.src(config.sources.globs.js).pipe(gulp.dest(config.root + config.targets.js))
|
||||
);
|
||||
|
||||
_.forEach(config.sources.js, function (group) {
|
||||
stream.add(
|
||||
processJs(group.files, group.out)
|
||||
);
|
||||
});
|
||||
|
||||
return stream;
|
||||
return stream;
|
||||
};
|
||||
|
||||
module.exports = { js: js };
|
||||
|
||||
@@ -14,19 +14,17 @@ function views() {
|
||||
_.forEach(config.sources.views, function (group) {
|
||||
|
||||
var task = gulp.src(group.files)
|
||||
.pipe(rename(function(path) {
|
||||
path.dirname = path.dirname.toLowerCase();
|
||||
path.basename = path.basename.toLowerCase();
|
||||
path.extname = path.extname.toLowerCase();
|
||||
}));
|
||||
.pipe(rename(function (path) {
|
||||
path.dirname = path.dirname.toLowerCase();
|
||||
path.basename = path.basename.toLowerCase();
|
||||
path.extname = path.extname.toLowerCase();
|
||||
}));
|
||||
|
||||
_.forEach(config.roots, function(root){
|
||||
var destPath = root + config.targets.views + group.folder;
|
||||
console.log("copying " + group.files + " to " + destPath)
|
||||
task = task.pipe( gulp.dest(destPath));
|
||||
})
|
||||
var destPath = config.root + config.targets.views + group.folder;
|
||||
console.log("copying " + group.files + " to " + destPath)
|
||||
task = task.pipe(gulp.dest(destPath));
|
||||
|
||||
stream.add (task);
|
||||
stream.add(task);
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const config = require('../config');
|
||||
const {watch, series, parallel, dest, src} = require('gulp');
|
||||
const { watch, series, parallel, dest, src } = require('gulp');
|
||||
|
||||
var _ = require('lodash');
|
||||
var rename = require('gulp-rename');
|
||||
@@ -10,7 +10,7 @@ var MergeStream = require('merge-stream');
|
||||
var processJs = require('../util/processJs');
|
||||
var processLess = require('../util/processLess');
|
||||
|
||||
var {js} = require('./js');
|
||||
var { js } = require('./js');
|
||||
|
||||
function watchTask(cb) {
|
||||
|
||||
@@ -18,14 +18,14 @@ function watchTask(cb) {
|
||||
|
||||
//Setup a watcher for all groups of JS files
|
||||
_.forEach(config.sources.js, function (group) {
|
||||
if(group.watch !== false) {
|
||||
watch(group.files, { ignoreInitial: true, interval: watchInterval }, function JS_Group_Compile() { return processJs(group.files, group.out);});
|
||||
if (group.watch !== false) {
|
||||
watch(group.files, { ignoreInitial: true, interval: watchInterval }, function JS_Group_Compile() { return processJs(group.files, group.out); });
|
||||
}
|
||||
});
|
||||
|
||||
//Setup a watcher for all groups of LESS files
|
||||
_.forEach(config.sources.less, function (group) {
|
||||
if(group.watch !== false) {
|
||||
if (group.watch !== false) {
|
||||
watch(group.watch, { ignoreInitial: true, interval: watchInterval }, function Less_Group_Compile() { return processLess(group.files, group.out); });
|
||||
}
|
||||
});
|
||||
@@ -33,22 +33,21 @@ function watchTask(cb) {
|
||||
//Setup a watcher for all groups of view files
|
||||
var viewWatcher;
|
||||
_.forEach(config.sources.views, function (group) {
|
||||
if(group.watch !== false) {
|
||||
if (group.watch !== false) {
|
||||
viewWatcher = watch(group.files, { ignoreInitial: true, interval: watchInterval },
|
||||
parallel(
|
||||
function MoveViewsAndRegenerateJS() {
|
||||
var task = src(group.files)
|
||||
.pipe(rename(function(path) {
|
||||
path.dirname = path.dirname.toLowerCase();
|
||||
path.basename = path.basename.toLowerCase();
|
||||
path.extname = path.extname.toLowerCase();
|
||||
}));
|
||||
|
||||
_.forEach(config.roots, function(root){
|
||||
var destPath = root + config.targets.views + group.folder;
|
||||
console.log("copying " + group.files + " to " + destPath);
|
||||
task = task.pipe( dest(destPath) );
|
||||
});
|
||||
var task = src(group.files)
|
||||
.pipe(rename(function (path) {
|
||||
path.dirname = path.dirname.toLowerCase();
|
||||
path.basename = path.basename.toLowerCase();
|
||||
path.extname = path.extname.toLowerCase();
|
||||
}));
|
||||
|
||||
var destPath = config.root + config.targets.views + group.folder;
|
||||
console.log("copying " + group.files + " to " + destPath);
|
||||
task = task.pipe(dest(destPath));
|
||||
},
|
||||
js
|
||||
)
|
||||
|
||||
@@ -11,11 +11,9 @@ var embedTemplates = require('gulp-angular-embed-templates');
|
||||
var _ = require('lodash');
|
||||
|
||||
module.exports = function (files, out) {
|
||||
|
||||
_.forEach(config.roots, function(root){
|
||||
console.log("JS: ", files, " -> ", root + config.targets.js + out)
|
||||
})
|
||||
|
||||
|
||||
console.log("JS: ", files, " -> ", config.root + config.targets.js + out)
|
||||
|
||||
var task = gulp.src(files);
|
||||
|
||||
// check for js errors
|
||||
@@ -31,13 +29,10 @@ module.exports = function (files, out) {
|
||||
if(config.compile.current.embedtemplates === true) {
|
||||
task = task.pipe(embedTemplates({ basePath: "./src/", minimize: { loose: true } }));
|
||||
}
|
||||
|
||||
task = task.pipe(concat(out)).pipe(wrap('(function(){\n%= body %\n})();'))
|
||||
|
||||
_.forEach(config.roots, function(root){
|
||||
task = task.pipe(gulp.dest(root + config.targets.js));
|
||||
})
|
||||
|
||||
task = task.pipe(concat(out))
|
||||
.pipe(wrap('(function(){\n%= body %\n})();'))
|
||||
.pipe(gulp.dest(config.root + config.targets.js));
|
||||
|
||||
|
||||
return task;
|
||||
|
||||
@@ -17,10 +17,8 @@ module.exports = function(files, out) {
|
||||
autoprefixer,
|
||||
cssnano({zindex: false})
|
||||
];
|
||||
_.forEach(config.roots, function(root){
|
||||
console.log("LESS: ", files, " -> ", root + config.targets.css + out);
|
||||
})
|
||||
|
||||
|
||||
console.log("LESS: ", files, " -> ", config.root + config.targets.css + out)
|
||||
|
||||
var task = gulp.src(files);
|
||||
|
||||
@@ -37,12 +35,7 @@ module.exports = function(files, out) {
|
||||
task = task.pipe(sourcemaps.write('./maps'));
|
||||
}
|
||||
|
||||
_.forEach(config.roots, function(root){
|
||||
task = task.pipe(gulp.dest(root + config.targets.css));
|
||||
})
|
||||
|
||||
|
||||
|
||||
task = task.pipe(gulp.dest(config.root + config.targets.css));
|
||||
|
||||
return task;
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ function externalLoginInfoService(externalLoginInfo, umbRequestHelper) {
|
||||
}
|
||||
|
||||
function getLoginProviderView(provider) {
|
||||
if (provider && provider.properties && provider.properties.UmbracoBackOfficeExternalLoginOptions && provider.properties.UmbracoBackOfficeExternalLoginOptions.CustomBackOfficeView) {
|
||||
return umbRequestHelper.convertVirtualToAbsolutePath(provider.properties.UmbracoBackOfficeExternalLoginOptions.CustomBackOfficeView);
|
||||
if (provider && provider.properties && provider.properties.CustomBackOfficeView) {
|
||||
return umbRequestHelper.convertVirtualToAbsolutePath(provider.properties.CustomBackOfficeView);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -26,10 +26,10 @@ function externalLoginInfoService(externalLoginInfo, umbRequestHelper) {
|
||||
*/
|
||||
function hasDenyLocalLogin(provider) {
|
||||
if (!provider) {
|
||||
return _.some(externalLoginInfo.providers, x => x.properties && x.properties.UmbracoBackOfficeExternalLoginOptions && (x.properties.UmbracoBackOfficeExternalLoginOptions.DenyLocalLogin === true));
|
||||
return _.some(externalLoginInfo.providers, x => x.properties && (x.properties.DenyLocalLogin === true));
|
||||
}
|
||||
else {
|
||||
return provider && provider.properties && provider.properties.UmbracoBackOfficeExternalLoginOptions && (provider.properties.UmbracoBackOfficeExternalLoginOptions.DenyLocalLogin === true);
|
||||
return provider && provider.properties && (provider.properties.DenyLocalLogin === true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user