Skip to content
Snippets Groups Projects

Release: Sprint/2023 05 :robot:

Merged CoscineBot requested to merge dev into master
1 file
+ 13
3
Compare changes
  • Side-by-side
  • Inline
@@ -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)
Loading