Skip to content

Commit

Permalink
Merge changes from release branch before release beta3.
Browse files Browse the repository at this point in the history
  • Loading branch information
tusmester committed Jul 10, 2017
1 parent 897328d commit bdc1986
Show file tree
Hide file tree
Showing 34 changed files with 101 additions and 133 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Welcome to sensenet ECM
The first Open Source Enterprise Content Management platform for .NET!
The first Open Source Enterprise Content Management platform for .NET!

> [Try it online](http://www.sensenet.com/try-it) without installation!
[![Join the chat at https://gitter.im/SenseNet/sensenet](https://badges.gitter.im/SenseNet/sensenet.svg)](https://gitter.im/SenseNet/sensenet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Expand Down
8 changes: 8 additions & 0 deletions docs/cors.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
title: "Cross-origin resource sharing"
source_url: 'https://github.com/SenseNet/sensenet/docs/cors.md'
category: Development
version: v7.0
tags: [CORS, authentication, jwt, login, origin, http headers, preflight, OData, REST]
---

# Cross-origin resource sharing
[Cross-origin resource sharing](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) (CORS) is a technique that allows client-side web developers to access resources from a *different domain*. Shared JavaScript files or images are good examples for this. However cross-origin requests can also be used by hackers and malicious sites to access confidential information if a site is not protected against [Cross Site Request Forgery](http://hu.wikipedia.org/wiki/Cross-site_request_forgery) (CSRF) attacks. This is why browsers apply strict rules for these operations to prevent hackers from accessing the portal from external sites.

Expand Down
12 changes: 4 additions & 8 deletions docs/install-sn-from-nuget.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,11 @@ This is why we decided to publish two types of packages for our components:
### Web app changes
> The install process described below is the same that you will see in the _readme.txt_ that appears in *Visual Studio* after adding the install package.
1. Please copy the contents of the **runtime** section from your *Web.config* to the *[web]\Tools\SnAdminRuntime.exe.config* file.

> See the placeholder comment at the end of SnAdminRuntime.exe.config.
2. Change the *Global.asax* **markup** file's (not the cs file's) first line to contain a new parent type:
1. Change the *Global.asax* **markup** file's (not the cs file's) first line to contain a new parent type:

`Inherits="SenseNet.Portal.Global"`

3. Change the *Global.asax.cs* **codebehind** (the c# class):
2. Change the *Global.asax.cs* **codebehind** (the c# class):

- the application class should inherit from **SenseNet.Services.SenseNetGlobal**
- change the *Application_Start* **method header** and call the **base method** before all generated and custom method calls:
Expand All @@ -77,15 +73,15 @@ This is why we decided to publish two types of packages for our components:

Please do not override the whole method (!), just the header, and add the base method call as seen above.

4. Optional: update your **Razor views** (you can do this later at any time).
3. Optional: update your **Razor views** (you can do this later at any time).

If you use the built-in *@Html.ActionLink* method to render actions (as it is the case with the default project templates), you have to replace those calls in your *.cshtml* files with a new extension method added by this package:

`@Html.MvcActionLink`

(the parameters are the same, only the method name changes)

5. **Build your solution**, make sure that there are no build errors.
4. **Build your solution**, make sure that there are no build errors.

### Create the database
Before installing the sensenet ECM Content Repository database, please make sure that you have access to a *SQL database server*.
Expand Down
14 changes: 11 additions & 3 deletions docs/sensenet-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ This is a list of the main components we published so far. To see an expanded, c
- [Services](#Services): core layer, mother of all components, all other packages are optional.
- [WebPages](#WebPages): admin UI and built-in building blocks for WebForms enthusiasts.

###### Feature packages (coming soon)
- Workspaces
- Workflows
###### Feature packages
- [Workspaces](#Workspaces): Workspace-related items (content types and templates, workspace dashboards and views) for sensenet ECM.
- [Workflow](#Workflow): Windows Workflow Foundation (WWF 4.5) integration into sensenet ECM.
- Content templates
- Notification
- ...and more!
Expand Down Expand Up @@ -70,3 +70,11 @@ This library connects to the sensenet ECM REST API (it is compatible with SN 6.5
Speed up your development process and focus on your business logic (either in a custom import or migration tool, or a rich WPF desktop client)!

![sensenet .Net client](https://github.com/SenseNet/sn-resources/raw/master/images/sn-components/sn-components_netclient.png "sensenet .Net client")

<a name="Workspaces"></a>
## Workspaces
The [Workspaces component](https://github.com/SenseNet/sn-workspaces) is useful for document management or project-oriented scenarios. It gives you predefined workspace structures and dashboards to help organizing different types of content that are related to a project or a client in a unified environment.

<a name="Workflow"></a>
## Workflow
Integrating **Windows Workflow Foundation (WWF 4.5)** into sensenet ECM provides many possibilities for creating content-driven workflows. The [Workflow component](https://github.com/SenseNet/sn-workflow) adds a robust and customizable workflow engine to sensenet ECM.
2 changes: 1 addition & 1 deletion src/Configuration/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]
[assembly: AssemblyInformationalVersion("7.0.0-beta2.1")]
[assembly: AssemblyInformationalVersion("7.0.0-beta3")]

[assembly: ComVisible(false)]
[assembly: Guid("dfbdb163-d9bb-481c-b3fd-e9eb0e37d27d")]
Expand Down
2 changes: 1 addition & 1 deletion src/ContentRepository/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]
[assembly: AssemblyInformationalVersion("7.0.0-beta2.1")]
[assembly: AssemblyInformationalVersion("7.0.0-beta3")]
4 changes: 2 additions & 2 deletions src/Services/ApplicationModel/WebdavOpenAction.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Lucene.Net.Support;
using SenseNet.Configuration;
using SenseNet.ContentRepository;
using SenseNet.Portal.Virtualization;
Expand Down Expand Up @@ -88,7 +88,7 @@ public override void Initialize(Content context, string backUri, Application app
this.Forbidden = true;
}

if (!Webdav.WebdavEditExtensions.Any(extension => context.Name.EndsWith(extension)))
if (!Webdav.WebdavEditExtensions.Any(extension => context.Name.EndsWith(extension, StringComparison.InvariantCultureIgnoreCase)))
this.Visible = false;
}
}
Expand Down
9 changes: 0 additions & 9 deletions src/Services/OData/ODataHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ public void ProcessRequest(HttpContext context, string httpMethod, Stream inputS
odataReq.Format = formatter.FormatName;
formatter.Initialize(odataReq);

// Cross-Origin Resource Sharing (CORS)
// Do this after the formatter was initialized to be able to provide a proper error message.
if (!HttpHeaderTools.IsOriginHeaderAllowed())
throw new ODataException(ODataExceptionCode.Forbidden);

var exists = Node.Exists(odataReq.RepositoryPath);
if (!exists && !odataReq.IsServiceDocumentRequest && !odataReq.IsMetadataRequest && !AllowedMethodNamesWithoutContent.Contains(httpMethod))
{
Expand Down Expand Up @@ -220,10 +215,6 @@ public void ProcessRequest(HttpContext context, string httpMethod, Stream inputS
content.Delete();
}
break;
case "OPTIONS":
// set allowed methods and headers
HttpHeaderTools.SetPreflightResponse();
break;
}
}
catch (ContentNotFoundException e)
Expand Down
14 changes: 4 additions & 10 deletions src/Services/OData/Typescript/TypescriptClassesVisitor.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SenseNet.ContentRepository.Schema.Metadata;

namespace SenseNet.Portal.OData.Typescript
Expand Down Expand Up @@ -49,8 +46,7 @@ protected override IMetaNode VisitClass(Class @class)
var propertyLines = new List<string>();
foreach (var property in visitedProperties)
{
var required = property.Type.Required ? "" : "?";
propertyLines.Add($"{property.Name}{required}: {GetPropertyTypeName(property)};");
propertyLines.Add($"{property.Name}?: {GetPropertyTypeName(property)};");
}

var type = @class.Name;
Expand All @@ -70,12 +66,10 @@ protected override IMetaNode VisitClass(Class @class)
WriteLine($" * @constructs {type}");
WriteLine($" * @param options {{object}} An object implementing {{@link I{type}Options" + "} interface");
WriteLine($" */");
WriteLine($"constructor(options: I{type}Options, repository: IRepository<any, any>) {{");
WriteLine($"constructor(public readonly options: I{type}Options, repository: IRepository<any, any>) {{");
WriteLine($" super(options, repository);");

_indentCount++;
foreach (var property in visitedProperties)
WriteLine($"this.{property.Name} = options.{property.Name};");
_indentCount--;
WriteLine("}");
WriteLine();
Expand All @@ -87,7 +81,7 @@ protected override IMetaNode VisitClass(Class @class)
WriteLine($" * @interface I{type}Options");
WriteLine($" * @extends {{@link I{parentName}Options" + "}");
WriteLine($" */");
WriteLine($"interface I{type}Options extends I{parentName}Options {{");
WriteLine($"export interface I{type}Options extends I{parentName}Options {{");
_indentCount++;
foreach (var propertyLine in propertyLines)
WriteLine(propertyLine);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ protected override IMetaNode VisitSchema(ContentRepository.Schema.Metadata.Schem
#region Write fileend
_writer.WriteLine(@"export class ChoiceOption {
Value: string;
Text: string;
Enabled: boolean;
Selected: boolean;
Text?: string;
Enabled?: boolean;
Selected?: boolean;
constructor(value: string, text?: string, enabled?: boolean, selected?: boolean) {
this.Value = value;
Expand Down
63 changes: 18 additions & 45 deletions src/Services/OData/Typescript/TypescriptCtdVisitor.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SenseNet.ContentRepository.Schema.Metadata;

namespace SenseNet.Portal.OData.Typescript
Expand All @@ -29,57 +26,38 @@ protected override IMetaNode VisitSchema(ContentRepository.Schema.Metadata.Schem
* The ```Schema``` class represents an object that holds the basic information about the Content Type (name, icon, ect.) and an array of its ```FieldSettings``` and their full configuration.
*/ /** */
import { FieldSettings } from './SN';
import { FieldSettings, Content, ContentTypes } from './SN';
/**
* Class that represents a Schema.
*
* It represents an object that holds the basic information about the Content Type (name, icon, ect.) and an array of its ```FieldSettings``` and their full configuration.
*/
export class Schema {
export class Schema<TContentType extends Content> {
ContentType: {new(...args): TContentType}
Icon: string;
DisplayName: string;
Description: string;
AllowIndexing: boolean;
AllowIncrementalNaming: boolean;
AllowedChildTypes: string[];
FieldSettings: FieldSettings.FieldSetting[];
/**
* @constructs Schema
* @param options {Object} An object implementing ISchemaOptions interface;
*/
constructor(options: ISchemaOptions) {
this.Icon = options.Icon;
this.DisplayName = options.DisplayName;
this.Description = options.Description;
this.FieldSettings = options.FieldSettings;
this.AllowIndexing = options.AllowIndexing;
this.AllowIncrementalNaming = options.AllowIncrementalNaming;
this.AllowedChildTypes = options.AllowedChildTypes;
constructor(schema: Partial<Schema<TContentType>>){
Object.assign(this, schema);
}
}
/**
* Interface for classes that represent a Schema.
*
* @interface ISchemaOptions
*/
export interface ISchemaOptions {
Icon?: string;
DisplayName?: string;
Description?: string;
AllowIndexing?: boolean;
AllowIncrementalNaming?: boolean;
AllowedChildTypes?: string[];
FieldSettings?: FieldSettings.FieldSetting[];
}
export const SchemaStore: Schema<Content>[] = [
");
#endregion

// Do not call base because only classes will be read.
_indentCount++;
Visit(schema.Classes);
_indentCount--;

_writer.WriteLine(@"]");
return schema;
}

Expand All @@ -94,27 +72,25 @@ protected override IMetaNode VisitClass(Class @class)
WriteLine($" * Method that returns the Content Type Definition of the {contentType.Name}");
WriteLine(" * @returns {Schema}");
WriteLine(" */");
WriteLine($"export function {contentType.Name}CTD(): Schema {{");
WriteLine($"new Schema({{");
_indentCount++;

WriteLine($"let options: ISchemaOptions = {{");
WriteLine($" ContentType: ContentTypes.{contentType.Name},");
WriteLine($" DisplayName: '{contentType.DisplayName}',");
WriteLine($" Description: '{contentType.Description}',");
WriteLine($" Icon: '{contentType.Icon}',");
WriteLine($" AllowIndexing: {contentType.IndexingEnabled.ToString().ToLowerInvariant()},");
WriteLine($" AllowIncrementalNaming: {contentType.AllowIncrementalNaming.ToString().ToLowerInvariant()},");
WriteLine($" AllowedChildTypes: [{allowedChildTypes}],");
WriteLine($" FieldSettings: []");
WriteLine($"}};");
WriteLine();
WriteLine($"let schema = new Schema(options);");
WriteLine();
WriteLine($" FieldSettings: [");

var visitedClass = base.VisitClass(@class);

WriteLine($"return schema;");
WriteLine($"]");
WriteLine($"}}),");
WriteLine();

_indentCount--;
WriteLine("}");

return visitedClass;
}
Expand All @@ -136,9 +112,6 @@ protected override IMetaNode VisitProperty(Property property)
if (value != null)
propertyLines.Add(name.ToCamelCase() + ": " + value);
}


WriteLine("schema.FieldSettings.push(");
_indentCount++;
WriteLine($"new FieldSettings.{property.FieldSetting.GetType().Name}({{");
_indentCount++;
Expand All @@ -148,7 +121,7 @@ protected override IMetaNode VisitProperty(Property property)
WriteLine($"{propertyLines[i]}{comma}");
}
_indentCount--;
WriteLine("}));");
WriteLine("}),");
_indentCount--;
return base.VisitProperty(property);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected override IMetaNode VisitSchema(ContentRepository.Schema.Metadata.Schem
export enum UrlFormat { Hyperlink, Picture }
export class FieldSetting {
Name: string = 'Content';
Name: string;
DisplayName?: string;
Description?: string;
Icon?: string;
Expand All @@ -79,7 +79,7 @@ protected override IMetaNode VisitSchema(ContentRepository.Schema.Metadata.Schem
ControlHint?: string;
constructor(options: IFieldSettingOptions) {
this.Name = options.name;
this.Name = options.name || 'Content';
this.DisplayName = options.displayName;
this.Icon = options.icon;
this.ReadOnly = options.readOnly;
Expand Down Expand Up @@ -152,7 +152,7 @@ private void WriteFieldSettingType(Type type, List<string> occurence)
WriteLine($"export class {type.Name} extends {parentTypeName} {{");
_indentCount++;
foreach (var item in propertyInfos)
WriteLine($"{item.Key}: {item.Value};");
WriteLine($"{item.Key}?: {item.Value};");
WriteLine();

WriteLine($"constructor(options: I{type.Name}Options) {{");
Expand Down
2 changes: 1 addition & 1 deletion src/Services/OData/Typescript/TypescriptModuleWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ protected virtual string GetPropertyTypeName(Type type)
case "String": return STRING;
case "Guid": return STRING;
case "Boolean": return "boolean";
case "DateTime": return "Date";
case "DateTime": return STRING;
case "Currency": return NUMBER;
case "Byte": return NUMBER;
case "SByte": return NUMBER;
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@

// This attribute is used by NuGet to determine the package file name and version.
// It may contain a SemVer value.
[assembly: AssemblyInformationalVersion("7.0.0-beta2.1")]
[assembly: AssemblyInformationalVersion("7.0.0-beta3")]
6 changes: 3 additions & 3 deletions src/Services/Services.Install.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>SenseNet.Services.Install</id>
<version>7.0.0-beta2.1</version>
<version>7.0.0-beta3</version>
<title>sensenet ECM Services install package</title>
<authors>kavics,aniko,laci,borsi,lajos,tusmester</authors>
<owners>Sense/Net</owners>
Expand All @@ -15,8 +15,8 @@
<copyright>Copyright © Sense/Net Inc.</copyright>
<tags>sensenet ecm ecms</tags>
<dependencies>
<dependency id="SenseNet.Services" version="7.0.0-beta2.1" />
<dependency id="SenseNet.SnAdmin" version="1.4.2" />
<dependency id="SenseNet.Services" version="7.0.0-beta3" />
<dependency id="SenseNet.SnAdmin" version="1.4.3" />
</dependencies>
</metadata>
<files>
Expand Down
Loading

0 comments on commit bdc1986

Please sign in to comment.