Commit d7317f08 authored by Benedikt Heinrichs's avatar Benedikt Heinrichs
Browse files

Merge branch 'Topic/1115-docuProjectApi' into 'Product/932-docuProjectApi'

Update: Document the Project Api

See merge request coscine/api/project!113
parents 94de2aff 779e1477
...@@ -86,8 +86,8 @@ ...@@ -86,8 +86,8 @@
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath> <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference> </Reference>
<Reference Include="HtmlAgilityPack, Version=1.8.2.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL"> <Reference Include="HtmlAgilityPack, Version=1.11.17.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlAgilityPack.1.8.2\lib\Net45\HtmlAgilityPack.dll</HintPath> <HintPath>..\packages\HtmlAgilityPack.1.11.17\lib\Net45\HtmlAgilityPack.dll</HintPath>
</Reference> </Reference>
<Reference Include="linq2db, Version=3.1.1.0, Culture=neutral, PublicKeyToken=e41013125f9e410a, processorArchitecture=MSIL"> <Reference Include="linq2db, Version=3.1.1.0, Culture=neutral, PublicKeyToken=e41013125f9e410a, processorArchitecture=MSIL">
<HintPath>..\packages\linq2db.3.1.1\lib\net46\linq2db.dll</HintPath> <HintPath>..\packages\linq2db.3.1.1\lib\net46\linq2db.dll</HintPath>
......
...@@ -21,19 +21,22 @@ namespace Coscine.Api.Project.Tests ...@@ -21,19 +21,22 @@ namespace Coscine.Api.Project.Tests
{ {
private static ILogger<ProjectController> projectLogger = null; private static ILogger<ProjectController> projectLogger = null;
private static ILogger<ProjectController> ProjectLogger { get private static ILogger<ProjectController> ProjectLogger
{ {
if (projectLogger == null) get
{ {
CoscineLoggerConfiguration.SetConfig(); if (projectLogger == null)
projectLogger = new NullLogger<ProjectController>(); {
CoscineLoggerConfiguration.SetConfig();
projectLogger = new NullLogger<ProjectController>();
}
return projectLogger;
} }
return projectLogger; }
} }
public ProjectControllerTests() : base(new ProjectController(ProjectLogger)) public ProjectControllerTests() : base(new ProjectController(ProjectLogger))
{ {
} }
[Test] [Test]
...@@ -55,14 +58,14 @@ namespace Coscine.Api.Project.Tests ...@@ -55,14 +58,14 @@ namespace Coscine.Api.Project.Tests
[Test] [Test]
public void TestControllerIndex() public void TestControllerIndex()
{ {
var actionResult = Controller.Index(); var actionResult = Controller.Index().Result;
Assert.IsTrue(actionResult.GetType() == typeof(OkObjectResult)); Assert.IsTrue(actionResult.GetType() == typeof(OkObjectResult));
} }
[Test] [Test]
public void TestControllerGet() public void TestControllerGet()
{ {
var actionResult = Controller.Get(Projects[0].Id.ToString()); var actionResult = Controller.Get(Projects[0].Id.ToString()).Result;
Assert.IsTrue(actionResult.GetType() == typeof(OkObjectResult)); Assert.IsTrue(actionResult.GetType() == typeof(OkObjectResult));
OkObjectResult okObjectResult = (OkObjectResult)actionResult; OkObjectResult okObjectResult = (OkObjectResult)actionResult;
...@@ -83,17 +86,17 @@ namespace Coscine.Api.Project.Tests ...@@ -83,17 +86,17 @@ namespace Coscine.Api.Project.Tests
[Test] [Test]
public void TestControllerUpdate() public void TestControllerUpdate()
{ {
var actionResult = Controller.Get(Projects[0].Id.ToString()); var actionResult = Controller.Get(Projects[0].Id.ToString()).Result;
ProjectObject projectObject = (ProjectObject)((OkObjectResult)actionResult).Value; ProjectObject projectObject = (ProjectObject)((OkObjectResult)actionResult).Value;
projectObject.Description = "ChangedDescription"; projectObject.Description = "ChangedDescription";
Stream stream = ObjectFactory<ProjectObject>.SerializeToStream(projectObject); Stream stream = ObjectFactory<ProjectObject>.SerializeToStream(projectObject);
FakeControllerContext(Users[0], stream); FakeControllerContext(Users[0], stream);
actionResult = Controller.Update(Projects[0].Id.ToString()); var updateResult = Controller.Update(Projects[0].Id.ToString());
Assert.IsTrue(actionResult.GetType() == typeof(OkObjectResult)); Assert.IsTrue(updateResult.GetType() == typeof(OkObjectResult));
// Cleanup // Cleanup
stream.Close(); stream.Close();
...@@ -102,8 +105,8 @@ namespace Coscine.Api.Project.Tests ...@@ -102,8 +105,8 @@ namespace Coscine.Api.Project.Tests
FakeControllerContext(Users[0], stream); FakeControllerContext(Users[0], stream);
actionResult = Controller.Update(Projects[1].Id.ToString()); updateResult = Controller.Update(Projects[1].Id.ToString());
Assert.IsTrue(actionResult.GetType() == typeof(UnauthorizedObjectResult)); Assert.IsTrue(updateResult.GetType() == typeof(UnauthorizedObjectResult));
// Cleanup // Cleanup
stream.Close(); stream.Close();
...@@ -112,7 +115,7 @@ namespace Coscine.Api.Project.Tests ...@@ -112,7 +115,7 @@ namespace Coscine.Api.Project.Tests
[Test] [Test]
public void TestControllerStore() public void TestControllerStore()
{ {
ProjectObject newProjectObject = new ProjectObject(Guid.NewGuid(), "NewProject", "NewDisplayName", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3", "abc", "investigator", "grandId", ProjectObject newProjectObject = new ProjectObject(Guid.NewGuid(), "NewProject", "NewDisplayName", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3", "abc", "investigator", "grandId",
new List<DisciplineObject>() { new DisciplineObject(Discipline.Id, Discipline.Url, Discipline.DisplayNameDe, Discipline.DisplayNameEn) }, new List<DisciplineObject>() { new DisciplineObject(Discipline.Id, Discipline.Url, Discipline.DisplayNameDe, Discipline.DisplayNameEn) },
new List<OrganizationObject>() { new OrganizationObject(Organization, Organization) }, new List<OrganizationObject>() { new OrganizationObject(Organization, Organization) },
new VisibilityObject(Visibility.Id, Visibility.DisplayName), Guid.NewGuid().ToString()); new VisibilityObject(Visibility.Id, Visibility.DisplayName), Guid.NewGuid().ToString());
...@@ -181,7 +184,7 @@ namespace Coscine.Api.Project.Tests ...@@ -181,7 +184,7 @@ namespace Coscine.Api.Project.Tests
stream.Close(); stream.Close();
Controller.DeleteProject(project, true); Controller.DeleteProject(project, true);
} }
[Test] [Test]
public void TestControllerDeleteWithSubProjects() public void TestControllerDeleteWithSubProjects()
{ {
...@@ -247,7 +250,7 @@ namespace Coscine.Api.Project.Tests ...@@ -247,7 +250,7 @@ namespace Coscine.Api.Project.Tests
ProjectObject newSubProjectObject = new ProjectObject(Guid.NewGuid(), "NewSubProject", "NewDisplayNameSub", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3", "abc", "investigator", "grandId", ProjectObject newSubProjectObject = new ProjectObject(Guid.NewGuid(), "NewSubProject", "NewDisplayNameSub", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3", "abc", "investigator", "grandId",
new List<DisciplineObject>() { new DisciplineObject(Discipline.Id, Discipline.Url, Discipline.DisplayNameDe, Discipline.DisplayNameEn) }, new List<DisciplineObject>() { new DisciplineObject(Discipline.Id, Discipline.Url, Discipline.DisplayNameDe, Discipline.DisplayNameEn) },
new List<OrganizationObject>() { new OrganizationObject(Organization, Organization) }, new List<OrganizationObject>() { new OrganizationObject(Organization, Organization) },
new VisibilityObject(Visibility.Id, Visibility.DisplayName), Guid.NewGuid().ToString(), new VisibilityObject(Visibility.Id, Visibility.DisplayName), Guid.NewGuid().ToString(),
createdProjectObject.Id); createdProjectObject.Id);
var subStream = ObjectFactory<ProjectObject>.SerializeToStream(newSubProjectObject); var subStream = ObjectFactory<ProjectObject>.SerializeToStream(newSubProjectObject);
...@@ -259,7 +262,7 @@ namespace Coscine.Api.Project.Tests ...@@ -259,7 +262,7 @@ namespace Coscine.Api.Project.Tests
SubProjectModel subProjectModel = new SubProjectModel(); SubProjectModel subProjectModel = new SubProjectModel();
var subProjects = subProjectModel.GetAllWhere((x) => x.ProjectId == createdProjectObject.Id); var subProjects = subProjectModel.GetAllWhere((x) => x.ProjectId == createdProjectObject.Id);
foreach(var subProject in subProjects) foreach (var subProject in subProjects)
{ {
Assert.IsTrue(subProject.SubProjectId == createdSubProjectObject.Id); Assert.IsTrue(subProject.SubProjectId == createdSubProjectObject.Id);
Assert.IsTrue(subProject.ProjectId == createdProjectObject.Id); Assert.IsTrue(subProject.ProjectId == createdProjectObject.Id);
...@@ -281,4 +284,4 @@ namespace Coscine.Api.Project.Tests ...@@ -281,4 +284,4 @@ namespace Coscine.Api.Project.Tests
Assert.IsTrue(Previous == projectModel.GetAll().ToArray().Length - Projects.Count); Assert.IsTrue(Previous == projectModel.GetAll().ToArray().Length - Projects.Count);
} }
} }
} }
\ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<package id="Coscine.Logging" version="1.2.0" targetFramework="net472" /> <package id="Coscine.Logging" version="1.2.0" targetFramework="net472" />
<package id="Coscine.ProxyApi" version="1.3.0" targetFramework="net472" /> <package id="Coscine.ProxyApi" version="1.3.0" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net472" /> <package id="EntityFramework" version="6.4.4" targetFramework="net472" />
<package id="HtmlAgilityPack" version="1.8.2" targetFramework="net472" /> <package id="HtmlAgilityPack" version="1.11.17" targetFramework="net472" />
<package id="linq2db" version="3.1.1" targetFramework="net472" /> <package id="linq2db" version="3.1.1" targetFramework="net472" />
<package id="linq2db.SqlServer" version="2.6.4" targetFramework="net472" /> <package id="linq2db.SqlServer" version="2.6.4" targetFramework="net472" />
<package id="linq2db.t4models" version="2.6.4" targetFramework="net472" /> <package id="linq2db.t4models" version="2.6.4" targetFramework="net472" />
......
...@@ -2,22 +2,34 @@ ...@@ -2,22 +2,34 @@
using Coscine.Database.ReturnObjects; using Coscine.Database.ReturnObjects;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace Coscine.Api.Project.Controllers namespace Coscine.Api.Project.Controllers
{ {
/// <summary>
/// This controller represents the actions which can be taken with a discipline object.
/// </summary>
[Authorize] [Authorize]
public class DisciplineController : Controller public class DisciplineController : Controller
{ {
private readonly DisciplineModel _disciplineModel; private readonly DisciplineModel _disciplineModel;
/// <summary>
/// DisciplineController constructor specifying a DisciplineModel
/// </summary>
public DisciplineController() public DisciplineController()
{ {
_disciplineModel = new DisciplineModel(); _disciplineModel = new DisciplineModel();
} }
/// <summary>
/// Returns all available disciplines
/// </summary>
/// <returns>All Disciplines</returns>
[Route("[controller]")] [Route("[controller]")]
public IActionResult Index() public ActionResult<IEnumerable<DisciplineObject>> Index()
{ {
return Json(_disciplineModel.GetAll() return Json(_disciplineModel.GetAll()
.OrderBy(discipline => discipline.DisplayNameDe.Substring(discipline.DisplayNameDe.Length - 3)) .OrderBy(discipline => discipline.DisplayNameDe.Substring(discipline.DisplayNameDe.Length - 3))
......
...@@ -2,22 +2,34 @@ ...@@ -2,22 +2,34 @@
using Coscine.Database.ReturnObjects; using Coscine.Database.ReturnObjects;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace Coscine.Api.Project.Controllers namespace Coscine.Api.Project.Controllers
{ {
/// <summary>
/// This controller represents the actions which can be taken with a license object.
/// </summary>
[Authorize] [Authorize]
public class LicenseController : Controller public class LicenseController : Controller
{ {
private readonly LicenseModel _licenseModel; private readonly LicenseModel _licenseModel;
/// <summary>
/// LicenseController constructor specifying a LicenseModel
/// </summary>
public LicenseController() public LicenseController()
{ {
_licenseModel = new LicenseModel(); _licenseModel = new LicenseModel();
} }
/// <summary>
/// Returns all available licenses
/// </summary>
/// <returns>All Licenses</returns>
[Route("[controller]")] [Route("[controller]")]
public IActionResult Index() public ActionResult<IEnumerable<LicenseObject>> Index()
{ {
return Json(_licenseModel.GetAll() return Json(_licenseModel.GetAll()
.Select((license) => new LicenseObject(license.Id, license.DisplayName))); .Select((license) => new LicenseObject(license.Id, license.DisplayName)));
......
...@@ -20,6 +20,10 @@ using Coscine.Metadata; ...@@ -20,6 +20,10 @@ using Coscine.Metadata;
namespace Coscine.Api.Project.Controllers namespace Coscine.Api.Project.Controllers
{ {
/// <summary>
/// /// This controller represents the actions which can be taken with a project object.
/// </summary>
[Authorize] [Authorize]
public class ProjectController : Controller public class ProjectController : Controller
{ {
...@@ -32,6 +36,10 @@ namespace Coscine.Api.Project.Controllers ...@@ -32,6 +36,10 @@ namespace Coscine.Api.Project.Controllers
private readonly CoscineLogger _coscineLogger; private readonly CoscineLogger _coscineLogger;
private readonly AnalyticsLogObject _analyticsLogObject; private readonly AnalyticsLogObject _analyticsLogObject;
/// <summary>
/// ProjectController constructor
/// </summary>
/// <param name="logger">Logger</param>
public ProjectController(ILogger<ProjectController> logger) public ProjectController(ILogger<ProjectController> logger)
{ {
_authenticator = new Authenticator(this, Program.Configuration); _authenticator = new Authenticator(this, Program.Configuration);
...@@ -43,9 +51,13 @@ namespace Coscine.Api.Project.Controllers ...@@ -43,9 +51,13 @@ namespace Coscine.Api.Project.Controllers
_coscineLogger = new CoscineLogger(logger); _coscineLogger = new CoscineLogger(logger);
_analyticsLogObject = new AnalyticsLogObject(); _analyticsLogObject = new AnalyticsLogObject();
} }
/// <summary>
/// Returns all available projects (including sub projects)
/// </summary>
/// <returns>Ok</returns>
[Route("[controller]")] [Route("[controller]")]
public IActionResult Index() public ActionResult<IEnumerable<ProjectObject>> Index()
{ {
var user = _authenticator.GetUser(); var user = _authenticator.GetUser();
var result = _projectModel.GetWithAccess(user, UserRoles.Member, UserRoles.Owner).ToList() var result = _projectModel.GetWithAccess(user, UserRoles.Member, UserRoles.Owner).ToList()
...@@ -60,8 +72,12 @@ namespace Coscine.Api.Project.Controllers ...@@ -60,8 +72,12 @@ namespace Coscine.Api.Project.Controllers
return Ok(result); return Ok(result);
} }
/// <summary>
/// Retrieves all top level projects
/// </summary>
/// <returns>Ok</returns>
[Route("[controller]/-/topLevel")] [Route("[controller]/-/topLevel")]
public IActionResult GetTopLevelProjects() public ActionResult<IEnumerable<ProjectObject>> GetTopLevelProjects()
{ {
var user = _authenticator.GetUser(); var user = _authenticator.GetUser();
var result = _projectModel.GetTopLevelWithAccess(user, UserRoles.Member, UserRoles.Owner).ToList() var result = _projectModel.GetTopLevelWithAccess(user, UserRoles.Member, UserRoles.Owner).ToList()
...@@ -76,8 +92,13 @@ namespace Coscine.Api.Project.Controllers ...@@ -76,8 +92,13 @@ namespace Coscine.Api.Project.Controllers
return Ok(result); return Ok(result);
} }
/// <summary>
/// This returns the the project if the user has access to it
/// </summary>
/// <param name="id">Id of the resource</param>
/// <returns>Ok or Statuscode 401</returns>
[HttpGet("[controller]/{id}")] [HttpGet("[controller]/{id}")]
public IActionResult Get(string id) public ActionResult<ProjectObject> Get(string id)
{ {
var user = _authenticator.GetUser(); var user = _authenticator.GetUser();
var project = _projectModel.GetById(Guid.Parse(id)); var project = _projectModel.GetById(Guid.Parse(id));
...@@ -99,8 +120,13 @@ namespace Coscine.Api.Project.Controllers ...@@ -99,8 +120,13 @@ namespace Coscine.Api.Project.Controllers
} }
} }
/// <summary>
/// Gets the resources
/// </summary>
/// <param name="id">Id of the resource</param>
/// <returns>Json object or Statuscode 401</returns>
[HttpGet("[controller]/{id}/resources")] [HttpGet("[controller]/{id}/resources")]
public IActionResult GetResources(string id) public ActionResult<IEnumerable<ResourceObject>> GetResources(string id)
{ {
var project = _projectModel.GetById(Guid.Parse(id)); var project = _projectModel.GetById(Guid.Parse(id));
var user = _authenticator.GetUser(); var user = _authenticator.GetUser();
...@@ -129,8 +155,13 @@ namespace Coscine.Api.Project.Controllers ...@@ -129,8 +155,13 @@ namespace Coscine.Api.Project.Controllers
} }
} }
/// <summary>
/// Retrieves the quota for the selected project
/// </summary>
/// <param name="id">Id of the resource</param>
/// <returns>Json object or Statuscode 401</returns>
[HttpGet("[controller]/{id}/quotas")] [HttpGet("[controller]/{id}/quotas")]
public IActionResult Quotas(string id) public ActionResult<IEnumerable<ProjectQuota>> Quotas(string id)
{ {
var user = _authenticator.GetUser(); var user = _authenticator.GetUser();
var projectObject = ObjectFactory<ProjectObject>.DeserializeFromStream(Request.Body); var projectObject = ObjectFactory<ProjectObject>.DeserializeFromStream(Request.Body);
...@@ -177,6 +208,11 @@ namespace Coscine.Api.Project.Controllers ...@@ -177,6 +208,11 @@ namespace Coscine.Api.Project.Controllers
} }
} }
/// <summary>
/// Updates the selected project
/// </summary>
/// <param name="id">Id of the resource</param>
/// <returns>Ok or Statuscode 401</returns>
[HttpPost("[controller]/{id}")] [HttpPost("[controller]/{id}")]
public IActionResult Update(string id) public IActionResult Update(string id)
{ {
...@@ -194,6 +230,11 @@ namespace Coscine.Api.Project.Controllers ...@@ -194,6 +230,11 @@ namespace Coscine.Api.Project.Controllers
} }
} }
/// <summary>
/// Deletes the selected project
/// </summary>
/// <param name="id">Id of the resource</param>
/// <returns>Json object or Statuscode 401</returns>
[HttpDelete("[controller]/{id}")] [HttpDelete("[controller]/{id}")]
public IActionResult Delete(string id) public IActionResult Delete(string id)
{ {
...@@ -211,6 +252,12 @@ namespace Coscine.Api.Project.Controllers ...@@ -211,6 +252,12 @@ namespace Coscine.Api.Project.Controllers
} }
} }
/// <summary>
/// Deletes the project
/// </summary>
/// <param name="project">Project</param>
/// <param name="isHard">isHard</param>
/// <param name="propegateAction">propegate Action</param>
public void DeleteProject(Database.DataModel.Project project, bool isHard = false, bool propegateAction = true) public void DeleteProject(Database.DataModel.Project project, bool isHard = false, bool propegateAction = true)
{ {
var subProjectModel = new SubProjectModel(); var subProjectModel = new SubProjectModel();
...@@ -292,6 +339,10 @@ namespace Coscine.Api.Project.Controllers ...@@ -292,6 +339,10 @@ namespace Coscine.Api.Project.Controllers
} }
} }
/// <summary>
/// Creates a project
/// </summary>
/// <returns>Json object or Statuscode 401</returns>
[HttpPost("[controller]")] [HttpPost("[controller]")]
public IActionResult Store() public IActionResult Store()
{ {
...@@ -299,8 +350,7 @@ namespace Coscine.Api.Project.Controllers ...@@ -299,8 +350,7 @@ namespace Coscine.Api.Project.Controllers
var isRWTHMember = IsRWTHMember(user); var isRWTHMember = IsRWTHMember(user);
var projectObject = ObjectFactory<ProjectObject>.DeserializeFromStream(Request.Body); var projectObject = ObjectFactory<ProjectObject>.DeserializeFromStream(Request.Body);
if (projectObject.ParentId != null if (projectObject?.ParentId != new Guid()
&& projectObject.ParentId != new Guid()
&& !_projectModel.HasAccess(user, _projectModel.GetById(projectObject.ParentId), UserRoles.Owner)) && !_projectModel.HasAccess(user, _projectModel.GetById(projectObject.ParentId), UserRoles.Owner))
{ {
return Unauthorized("User is not allowed to create SubProjects."); return Unauthorized("User is not allowed to create SubProjects.");
...@@ -328,6 +378,11 @@ namespace Coscine.Api.Project.Controllers ...@@ -328,6 +378,11 @@ namespace Coscine.Api.Project.Controllers
return Json(_projectModel.CreateReturnObjectFromDatabaseObject(project)); return Json(_projectModel.CreateReturnObjectFromDatabaseObject(project));
} }
/// <summary>
/// Checks if the given user is a member of the RWTH
/// </summary>
/// <param name="user">User object</param>
/// <returns>True, if member of RWTH or false, if not a member of RWTH</returns>
private bool IsRWTHMember(User user) private bool IsRWTHMember(User user)
{ {
var externalIds = new ExternalIdModel().GetAllWhere((externalId) => externalId.UserId == user.Id); var externalIds = new ExternalIdModel().GetAllWhere((externalId) => externalId.UserId == user.Id);
...@@ -344,6 +399,14 @@ namespace Coscine.Api.Project.Controllers ...@@ -344,6 +399,14 @@ namespace Coscine.Api.Project.Controllers
return new RdfStoreConnector(Program.Configuration.GetStringAndWait("coscine/local/virtuoso/additional/url")).GetTriples(new Uri("https://ror.org/04xfq0f34"), null, null, 1, externalIdList).Count() != 0; return new RdfStoreConnector(Program.Configuration.GetStringAndWait("coscine/local/virtuoso/additional/url")).GetTriples(new Uri("https://ror.org/04xfq0f34"), null, null, 1, externalIdList).Count() != 0;
} }
/// <summary>
/// LogAnalytics
/// </summary>
/// <param name="operation">Operation</param>
/// <param name="projects">Projects</param>
/// <param name="resources">Resources</param>
/// <param name="projectId">Id of the project</param>
/// <param name="user">User object</param>
private void LogAnalytics(string operation, private void LogAnalytics(string operation,
IEnumerable<ProjectObject> projects = null, IEnumerable<ProjectObject> projects = null,
IEnumerable<ResourceObject> resources = null, IEnumerable<ResourceObject> resources = null,
......
...@@ -18,6 +18,10 @@ using Coscine.Database.DataModel; ...@@ -18,6 +18,10 @@ using Coscine.Database.DataModel;
namespace Coscine.Api.Project.Controllers namespace Coscine.Api.Project.Controllers
{ {
/// <summary>
/// This represents the actions which can be taken with a ProjectRole Object
/// </summary>
[Authorize] [Authorize]
public class ProjectRoleController : Controller public class ProjectRoleController : Controller
{ {
...@@ -28,6 +32,10 @@ namespace Coscine.Api.Project.Controllers ...@@ -28,6 +32,10 @@ namespace Coscine.Api.Project.Controllers
private readonly CoscineLogger _coscineLogger; private readonly CoscineLogger _coscineLogger;
private readonly AnalyticsLogObject _analyticsLogObject; private readonly AnalyticsLogObject _analyticsLogObject;
/// <summary>
/// ProjectRoleController specifying an Emmiter, an Authentication,a ProjectRoleModel and a AnalyticsLogObject
/// </summary>
/// <param name="logger">Logger</param>
public ProjectRoleController(ILogger<ProjectRoleController> logger) public ProjectRoleController(ILogger<ProjectRoleController> logger)
{ {
_emitter = new Emitter(Program.Configuration); _emitter = new Emitter(Program.Configuration);
...@@ -39,8 +47,13 @@ namespace Coscine.Api.Project.Controllers ...@@ -39,8 +47,13 @@ namespace Coscine.Api.Project.Controllers
_analyticsLogObject = new AnalyticsLogObject(); _analyticsLogObject = new AnalyticsLogObject();
} }
/// <summary>
/// Lists all users to the given project
/// </summary>
/// <param name="projectId">Id of the project</param>