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/metadata
1 result
Select Git revision
Loading items
Show changes
Commits on Source (3)
...@@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Mvc; ...@@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web; using System.Web;
using VDS.RDF; using VDS.RDF;
...@@ -71,7 +72,12 @@ namespace Coscine.Api.Metadata.Controllers ...@@ -71,7 +72,12 @@ namespace Coscine.Api.Metadata.Controllers
[HttpGet("[controller]/profiles/{profile}")] [HttpGet("[controller]/profiles/{profile}")]
public IActionResult GetProfile(string profile) public IActionResult GetProfile(string profile)
{ {
string profileUrl = profile.StartsWith("http") ? HttpUtility.UrlDecode(profile) : $"{ApplicationProfileUrl}{profile}/"; var profileUrl = profile.StartsWith("http") ? HttpUtility.UrlDecode(profile) : $"{ApplicationProfileUrl}{profile}/";
if (!profileUrl.StartsWith(ApplicationProfileUrl))
{
return StatusCode((int)HttpStatusCode.Forbidden, $"Profile has to start with {ApplicationProfileUrl}!");
}
var graph = _rdfStoreConnector.GetGraph(profileUrl); var graph = _rdfStoreConnector.GetGraph(profileUrl);
...@@ -100,10 +106,15 @@ namespace Coscine.Api.Metadata.Controllers ...@@ -100,10 +106,15 @@ namespace Coscine.Api.Metadata.Controllers
if (user == null || !_resourceModel.HasAccess(user, resource, UserRoles.Owner, UserRoles.Member)) if (user == null || !_resourceModel.HasAccess(user, resource, UserRoles.Owner, UserRoles.Member))
{ {
return Forbid("User is no project member!"); return StatusCode((int)HttpStatusCode.Forbidden, "User is no project member!");
} }
string profileUrl = profile.StartsWith("http") ? HttpUtility.UrlDecode(profile) : $"{ApplicationProfileUrl}{profile}/"; var profileUrl = profile.StartsWith("http") ? HttpUtility.UrlDecode(profile) : $"{ApplicationProfileUrl}{profile}/";
if (!profileUrl.StartsWith(ApplicationProfileUrl))
{
return StatusCode((int)HttpStatusCode.Forbidden, $"Profile has to start with {ApplicationProfileUrl}!");
}
var graph = _rdfStoreConnector.GetGraph(profileUrl); var graph = _rdfStoreConnector.GetGraph(profileUrl);
var fixedValuesGraph = new Graph(); var fixedValuesGraph = new Graph();
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<AssemblyName>Coscine.Api.Metadata</AssemblyName> <AssemblyName>Coscine.Api.Metadata</AssemblyName>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<Version>2.2.0</Version> <Version>2.2.1</Version>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Authors>RWTH Aachen University</Authors> <Authors>RWTH Aachen University</Authors>
......