From 57c01f85d230358109384c21a2ad0ccb00785ca5 Mon Sep 17 00:00:00 2001 From: fossabot Date: Tue, 13 Feb 2018 01:23:01 -0800 Subject: [PATCH 1/5] Add license scan report and status Signed-off-by: fossabot --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 9c83fa2af..d6676749f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ![Squidex Logo](https://raw.githubusercontent.com/Squidex/squidex/master/media/logo-wide.png "Squidex") +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FSquidex%2Fsquidex.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FSquidex%2Fsquidex?ref=badge_shield) # What is Squidex?? @@ -40,3 +41,7 @@ Please create issues to report bugs, suggest new functionalities, ask questions ## Cloud Version Although Squidex is free we are also working on a Saas version on [https://cloud.squidex.io](https://cloud.squidex.io) (More information coming soon). We have also have plans to sell a premium version with first class support and some exlusive features. But don't be afraid, our first priority is to deliver a state of the art, stable, fast and free content management hub to make the life for developers a little bit easier. + + +## License +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FSquidex%2Fsquidex.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FSquidex%2Fsquidex?ref=badge_large) \ No newline at end of file From 5cd6ae9058b96f35d48c32674847bf4c334dc45d Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Tue, 13 Feb 2018 16:15:01 +0100 Subject: [PATCH 2/5] Middleware fixed. --- .../EnrichWithAppIdCommandMiddleware.cs | 29 ++++++++--- .../EnrichWithSchemaIdCommandMiddleware.cs | 52 ++++++++++++------- 2 files changed, 55 insertions(+), 26 deletions(-) diff --git a/src/Squidex/Pipeline/CommandMiddlewares/EnrichWithAppIdCommandMiddleware.cs b/src/Squidex/Pipeline/CommandMiddlewares/EnrichWithAppIdCommandMiddleware.cs index 1a063c723..8f724b1a9 100644 --- a/src/Squidex/Pipeline/CommandMiddlewares/EnrichWithAppIdCommandMiddleware.cs +++ b/src/Squidex/Pipeline/CommandMiddlewares/EnrichWithAppIdCommandMiddleware.cs @@ -9,6 +9,7 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Squidex.Domain.Apps.Entities; +using Squidex.Domain.Apps.Entities.Apps.Commands; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; @@ -32,17 +33,31 @@ namespace Squidex.Pipeline.CommandMiddlewares if (context.Command is IAppCommand appCommand && appCommand.AppId == null) { - var appFeature = httpContextAccessor.HttpContext.Features.Get(); + var appId = GetAppId(); - if (appFeature == null) - { - throw new InvalidOperationException("Cannot resolve app."); - } + appCommand.AppId = appId; + } + + if (context.Command is AppCommand appSelfCommand && appSelfCommand.AppId == Guid.Empty) + { + var appId = GetAppId(); - appCommand.AppId = new NamedId(appFeature.App.Id, appFeature.App.Name); + appSelfCommand.AppId = appId.Id; } return next(); } + + private NamedId GetAppId() + { + var appFeature = httpContextAccessor.HttpContext.Features.Get(); + + if (appFeature?.App == null) + { + throw new InvalidOperationException("Cannot resolve app."); + } + + return new NamedId(appFeature.App.Id, appFeature.App.Name); + } } -} +} \ No newline at end of file diff --git a/src/Squidex/Pipeline/CommandMiddlewares/EnrichWithSchemaIdCommandMiddleware.cs b/src/Squidex/Pipeline/CommandMiddlewares/EnrichWithSchemaIdCommandMiddleware.cs index 495131855..40b660c8a 100644 --- a/src/Squidex/Pipeline/CommandMiddlewares/EnrichWithSchemaIdCommandMiddleware.cs +++ b/src/Squidex/Pipeline/CommandMiddlewares/EnrichWithSchemaIdCommandMiddleware.cs @@ -36,28 +36,42 @@ namespace Squidex.Pipeline.CommandMiddlewares if (context.Command is ISchemaCommand schemaCommand && schemaCommand.SchemaId == null) { - NamedId appId = null; + var schemaId = await GetSchemaIdAsync(context); - if (context.Command is IAppCommand appCommand) - { - appId = appCommand.AppId; - } + schemaCommand.SchemaId = schemaId; + } - if (appId == null) - { - var appFeature = actionContextAccessor.ActionContext.HttpContext.Features.Get(); + if (context.Command is SchemaCommand schemaSelfCommand && schemaSelfCommand.SchemaId == Guid.Empty) + { + var schemaId = await GetSchemaIdAsync(context); - if (appFeature != null && appFeature.App != null) - { - appId = new NamedId(appFeature.App.Id, appFeature.App.Name); - } - } + schemaSelfCommand.SchemaId = schemaId?.Id ?? Guid.Empty; + } + + await next(); + } + + private async Task> GetSchemaIdAsync(CommandContext context) + { + NamedId appId = null; + + if (context.Command is IAppCommand appCommand) + { + appId = appCommand.AppId; + } - if (appId == null) + if (appId == null) + { + var appFeature = actionContextAccessor.ActionContext.HttpContext.Features.Get(); + + if (appFeature != null && appFeature.App != null) { - return; + appId = new NamedId(appFeature.App.Id, appFeature.App.Name); } + } + if (appId != null) + { var routeValues = actionContextAccessor.ActionContext.RouteData.Values; if (routeValues.ContainsKey("name")) @@ -77,14 +91,14 @@ namespace Squidex.Pipeline.CommandMiddlewares if (schema == null) { - throw new DomainObjectNotFoundException(schemaName, typeof(SchemaDomainObject)); + throw new DomainObjectNotFoundException(schemaName, typeof(ISchemaEntity)); } - schemaCommand.SchemaId = new NamedId(schema.Id, schema.Name); + return new NamedId(schema.Id, schema.Name); } } - await next(); + return null; } } -} +} \ No newline at end of file From 8d96009afac607035612034513e1df8a548a22b3 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Tue, 13 Feb 2018 16:18:56 +0100 Subject: [PATCH 3/5] Fossay fixed --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d6676749f..e8bd15355 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@ ![Squidex Logo](https://raw.githubusercontent.com/Squidex/squidex/master/media/logo-wide.png "Squidex") -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FSquidex%2Fsquidex.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FSquidex%2Fsquidex?ref=badge_shield) # What is Squidex?? Squidex is an open source headless CMS and content management hub. In contrast to a traditional CMS Squidex provides a rich API with OData filter and Swagger definitions. It is up to you to build your UI on top of it. It can be website, a native app or just another server. We build it with ASP.NET Core and CQRS and is tested for Windows and Linux on modern browsers. -[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg?style=square)](https://gitter.im/squidex-cms/Lobby) [![Slack](https://img.shields.io/badge/chat-on_slack-E01765.svg?style=square)](https://squidex-slack.herokuapp.com/) [![Build Status](http://build.squidex.io/api/badges/Squidex/squidex/status.svg)](http://build.squidex.io/Squidex/squidex) +[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg?style=square)](https://gitter.im/squidex-cms/Lobby) [![Slack](https://img.shields.io/badge/chat-on_slack-E01765.svg?style=square)](https://squidex-slack.herokuapp.com/) [![Build Status](http://build.squidex.io/api/badges/Squidex/squidex/status.svg)](http://build.squidex.io/Squidex/squidex) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FSquidex%2Fsquidex.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FSquidex%2Fsquidex?ref=badge_shield) Read the docs at [https://docs.squidex.io/](https://docs.squidex.io/) (work in progress) or just check out the code and play around. @@ -42,6 +41,6 @@ Please create issues to report bugs, suggest new functionalities, ask questions Although Squidex is free we are also working on a Saas version on [https://cloud.squidex.io](https://cloud.squidex.io) (More information coming soon). We have also have plans to sell a premium version with first class support and some exlusive features. But don't be afraid, our first priority is to deliver a state of the art, stable, fast and free content management hub to make the life for developers a little bit easier. - ## License + [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FSquidex%2Fsquidex.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FSquidex%2Fsquidex?ref=badge_large) \ No newline at end of file From 8fc51685b8a3056a52a920e08a0a890422cc29cc Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Tue, 13 Feb 2018 20:07:05 +0100 Subject: [PATCH 4/5] Fixed the resoling of app ids. --- .../Contents/ContentOperationContext.cs | 10 ++++++---- .../Commands/DomainObjectBase.cs | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs b/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs index 8660af246..fdbcd0386 100644 --- a/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs +++ b/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs @@ -31,6 +31,7 @@ namespace Squidex.Domain.Apps.Entities.Contents private IScriptEngine scriptEngine; private ISchemaEntity schemaEntity; private IAppEntity appEntity; + private Guid appId; private Func message; public static async Task CreateAsync( @@ -56,6 +57,7 @@ namespace Squidex.Domain.Apps.Entities.Contents var context = new ContentOperationContext { appEntity = appEntity, + appId = a.Id, assetRepository = assetRepository, contentRepository = contentRepository, content = content, @@ -88,11 +90,11 @@ namespace Squidex.Domain.Apps.Entities.Contents new ValidationContext( (contentIds, schemaId) => { - return QueryContentsAsync(content.Snapshot.AppId.Id, schemaId, contentIds); + return QueryContentsAsync(schemaId, contentIds); }, assetIds => { - return QueryAssetsAsync(content.Snapshot.AppId.Id, assetIds); + return QueryAssetsAsync(assetIds); }); if (partial) @@ -111,12 +113,12 @@ namespace Squidex.Domain.Apps.Entities.Contents } } - private async Task> QueryAssetsAsync(Guid appId, IEnumerable assetIds) + private async Task> QueryAssetsAsync(IEnumerable assetIds) { return await assetRepository.QueryAsync(appId, new HashSet(assetIds)); } - private async Task> QueryContentsAsync(Guid appId, Guid schemaId, IEnumerable contentIds) + private async Task> QueryContentsAsync(Guid schemaId, IEnumerable contentIds) { return await contentRepository.QueryNotFoundAsync(appId, schemaId, contentIds.ToList()); } diff --git a/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs b/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs index c4d0e0ef4..888c9ff9f 100644 --- a/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs +++ b/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs @@ -52,6 +52,8 @@ namespace Squidex.Infrastructure.Commands ApplyEvent(@event); + snapshot.Version++; + uncomittedEvents.Add(@event); } From 04d38513cdbfd045c372510199e9583643d27f18 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Tue, 13 Feb 2018 20:21:11 +0100 Subject: [PATCH 5/5] Date editor fixed --- .../app/framework/angular/date-time-editor.component.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Squidex/app/framework/angular/date-time-editor.component.ts b/src/Squidex/app/framework/angular/date-time-editor.component.ts index ad6103174..024d73b1d 100644 --- a/src/Squidex/app/framework/angular/date-time-editor.component.ts +++ b/src/Squidex/app/framework/angular/date-time-editor.component.ts @@ -191,19 +191,20 @@ export class DateTimeEditorComponent implements ControlValueAccessor, OnDestroy, } private updateControls() { - if (!this.dateValue) { - return; - } - this.suppressEvents = true; if (this.timeValue && this.timeValue.isValid()) { this.timeControl.setValue(this.timeValue.format('HH:mm:ss'), { emitEvent: false }); + } else { + this.timeControl.setValue(null, { emitEvent: false }); } + if (this.dateValue && this.dateValue.isValid() && this.picker) { this.dateControl.setValue(this.dateValue.format('YYYY-MM-DD'), { emitEvent: false }); this.picker.setMoment(this.dateValue); + } else { + this.dateControl.setValue(null, { emitEvent: false }); } this.suppressEvents = false;