Skip to content
Snippets Groups Projects

Sprint/201922

Merged Marcel Nellesen requested to merge Sprint/201922 into master
10 files
+ 72
22
Compare changes
  • Side-by-side
  • Inline
Files
10
@@ -39,13 +39,35 @@ namespace Coscine.Api.Project.Controllers
}));
}
[HttpGet("[controller]/resource/{resourceId}/ap/{applicationProfileId}")]
public IActionResult GetApplicationProfile(string resourceId, string applicationProfileId)
// returns the basic application profile
[HttpGet("[controller]/resource/{projectId}/ap/{applicationProfileId}")]
public IActionResult GetApplicationProfile(Guid projectId, string applicationProfileId)
{
var user = _authenticator.GetUserFromToken();
if (_metadataModel.IsProjectMember(user, projectId))
{
var graph = _util.GetGraph(HttpUtility.UrlDecode(applicationProfileId));
var json = JToken.Parse(VDS.RDF.Writing.StringWriter.Write(graph, new RdfJsonWriter()));
return Ok(json);
}
else
{
throw new NotAuthorizedException("User is no project member!");
}
}
// returns the application profile with the fixed values
[HttpGet("[controller]/resource/{resourceId}/apc/{applicationProfileId}")]
public IActionResult GetApplicationProfileComplete(string resourceId, string applicationProfileId)
{
var user = _authenticator.GetUserFromToken();
var resource = _resourceModel.GetById(Guid.Parse(resourceId));
if (_metadataModel.IsProjectMember(user, resource))
if (_metadataModel.IsProjectMember(user, resource) && applicationProfileId != null)
{
var graph = _util.GetGraph(HttpUtility.UrlDecode(applicationProfileId));
var fixedValuesGraph = new Graph();
@@ -55,7 +77,7 @@ namespace Coscine.Api.Project.Controllers
graph.Merge(fixedValuesGraph);
var json = JToken.Parse(VDS.RDF.Writing.StringWriter.Write(graph, new RdfJsonWriter()));
return Ok(json);
}
else
@@ -65,13 +87,12 @@ namespace Coscine.Api.Project.Controllers
}
[HttpGet("[controller]/resource/{resourceId}/aplist/")]
public IActionResult ListAllApplicationProfiles(string resourceId)
[HttpGet("[controller]/project/{projectId}/aplist/")]
public IActionResult ListAllApplicationProfiles(Guid projectId)
{
return Ok(_authenticator.ValidateAndExecute((user) =>
{
var resource = _resourceModel.GetById(Guid.Parse(resourceId));
if (_metadataModel.IsProjectMember(user, resource))
if (_metadataModel.IsProjectMember(user, projectId))
{
var graphUris = _util.ListGraphs();
@@ -169,13 +190,12 @@ namespace Coscine.Api.Project.Controllers
}));
}
[HttpGet("[controller]/vocabulary/{resourceId}/{path}")]
public IActionResult GetVocabulary(string resourceId, string path)
[HttpGet("[controller]/vocabulary/{projectId}/{path}")]
public IActionResult GetVocabulary(Guid projectId, string path)
{
return Ok(_authenticator.ValidateAndExecute((user) =>
{
var resource = _resourceModel.GetById(Guid.Parse(resourceId));
if (_metadataModel.IsProjectMember(user, resource))
if (_metadataModel.IsProjectMember(user, projectId))
{
var graph = _util.GetGraph(HttpUtility.UrlDecode(path));
Loading