Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • coscine/backend/apis/project
1 result
Select Git revision
Loading items
Show changes
Commits on Source (4)
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<RootNamespace>Coscine.Api.Project.Tests</RootNamespace> <RootNamespace>Coscine.Api.Project.Tests</RootNamespace>
<AssemblyName>Coscine.Api.Project.Tests</AssemblyName> <AssemblyName>Coscine.Api.Project.Tests</AssemblyName>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<Version>4.3.3</Version> <Version>4.3.4</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
...@@ -367,13 +367,23 @@ namespace Coscine.Api.Project.Controllers ...@@ -367,13 +367,23 @@ namespace Coscine.Api.Project.Controllers
} }
/// <summary> /// <summary>
/// Creates a project /// Creates a new project
/// </summary> /// </summary>
/// <param name="projectObject">A Project Object</param> /// <param name="projectObject">The project to create.</param>
/// <returns>JSON object or status code 401</returns> /// <returns>A JSON representation of the created project.</returns>
/// <response code="200">The project was created successfully.</response>
/// <response code="401">The user does not have sufficient permissions to create a project.</response>
/// <response code="422">The project object is invalid or contains invalid data.</response>
[HttpPost("[controller]")] [HttpPost("[controller]")]
public IActionResult Store([FromBody] ProjectObject projectObject) public IActionResult Store([FromBody] ProjectObject projectObject)
{ {
// ------
// This is the wrong place to do that, but we have to live with it. For the APIv2 consider moving that to a validation attribute.
// Also consider using the following Regex:
// (http|https):\/\/ror\.org\/[a-zA-Z0-9]+
if (projectObject.Organizations.Any(o => o.Url.Contains('#')))
return UnprocessableEntity("The URL of the organization cannot contain the '#' character. Only top-level organizations are allowed.");
// ------
var user = _authenticator.GetUser(); var user = _authenticator.GetUser();
// Rights Matrix (https://git.rwth-aachen.de/coscine/docs/private/internal-wiki/-/blob/master/coscine/Definition%20of%20rights%20Matrix.md) // Rights Matrix (https://git.rwth-aachen.de/coscine/docs/private/internal-wiki/-/blob/master/coscine/Definition%20of%20rights%20Matrix.md)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<AssemblyName>Coscine.Api.Project</AssemblyName> <AssemblyName>Coscine.Api.Project</AssemblyName>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<Version>4.3.3</Version> <Version>4.3.4</Version>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
......