Commit 98f18b27 authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

New: Included IsRWTHMember function for affiliation sensitivity (coscine/issues#1060)

parent 7aa0474d
......@@ -68,11 +68,11 @@
<Reference Include="Coscine.Configuration, Version=1.5.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Configuration.1.5.0\lib\net461\Coscine.Configuration.dll</HintPath>
</Reference>
<Reference Include="Coscine.Database, Version=1.24.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.24.0\lib\net461\Coscine.Database.dll</HintPath>
<Reference Include="Coscine.Database, Version=1.25.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.25.0\lib\net461\Coscine.Database.dll</HintPath>
</Reference>
<Reference Include="Coscine.Database.T4, Version=1.24.0.0, Culture=neutral, PublicKeyToken=84b4c404a0696261, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.24.0\lib\net461\Coscine.Database.T4.dll</HintPath>
<Reference Include="Coscine.Database.T4, Version=1.25.0.0, Culture=neutral, PublicKeyToken=84b4c404a0696261, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.25.0\lib\net461\Coscine.Database.T4.dll</HintPath>
</Reference>
<Reference Include="Coscine.Logging, Version=1.2.0.0, Culture=neutral, PublicKeyToken=e1ed402bc3f6525e, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Logging.1.2.0\lib\net461\Coscine.Logging.dll</HintPath>
......
......@@ -88,7 +88,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Coscine.Database" publicKeyToken="767d77427707b70a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.24.0.0" newVersion="1.24.0.0" />
<bindingRedirect oldVersion="0.0.0.0-1.25.0.0" newVersion="1.25.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral" />
......@@ -186,6 +186,14 @@
<assemblyIdentity name="linq2db" publicKeyToken="e41013125f9e410a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.1.0" newVersion="3.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.2.0" newVersion="1.8.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Coscine.Database.T4" publicKeyToken="84b4c404a0696261" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.25.0.0" newVersion="1.25.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
......
......@@ -7,7 +7,7 @@
<package id="Coscine.Action" version="1.15.1" targetFramework="net472" />
<package id="Coscine.ApiCommons" version="1.9.1" targetFramework="net472" />
<package id="Coscine.Configuration" version="1.5.0" targetFramework="net472" />
<package id="Coscine.Database" version="1.24.0" targetFramework="net472" />
<package id="Coscine.Database" version="1.25.0" targetFramework="net472" />
<package id="Coscine.Logging" version="1.2.0" targetFramework="net472" />
<package id="Coscine.ProxyApi" version="1.2.1" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net472" />
......
......@@ -91,7 +91,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Coscine.Database" publicKeyToken="767d77427707b70a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.24.0.0" newVersion="1.24.0.0" />
<bindingRedirect oldVersion="0.0.0.0-1.25.0.0" newVersion="1.25.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral" />
......@@ -189,6 +189,10 @@
<assemblyIdentity name="linq2db" publicKeyToken="e41013125f9e410a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.1.0" newVersion="3.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Coscine.Database.T4" publicKeyToken="84b4c404a0696261" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.25.0.0" newVersion="1.25.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
......
......@@ -16,6 +16,7 @@ using Newtonsoft.Json.Linq;
using Coscine.Database.DataModel;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Coscine.Metadata;
namespace Coscine.Api.Project.Controllers
{
......@@ -295,6 +296,7 @@ namespace Coscine.Api.Project.Controllers
public IActionResult Store()
{
var user = _authenticator.GetUser();
var isRWTHMember = IsRWTHMember(user);
var projectObject = ObjectFactory<ProjectObject>.DeserializeFromStream(Request.Body);
if (projectObject.ParentId != null
......@@ -304,7 +306,7 @@ namespace Coscine.Api.Project.Controllers
return Unauthorized("User is not allowed to create SubProjects.");
}
var project = _projectModel.StoreFromObject(projectObject, user);
var project = _projectModel.StoreFromObject(projectObject, user, isRWTHMember);
if (projectObject.ParentId != null
&& projectObject.ParentId != new Guid()
......@@ -326,6 +328,22 @@ namespace Coscine.Api.Project.Controllers
return Json(_projectModel.CreateReturnObjectFromDatabaseObject(project));
}
private bool IsRWTHMember(User user)
{
var externalIds = new ExternalIdModel().GetAllWhere((externalId) => externalId.UserId == user.Id);
if(externalIds.Count() == 0)
{
return false;
}
var externalIdList = new List<string>();
foreach (var externalId in externalIds)
{
externalIdList.Add(externalId.ExternalIdColumn);
}
return new RdfStoreConnector().GetTriples(new Uri("https://ror.org/04xfq0f34"), null, null, 1, externalIdList).Count() != 0;
}
private void LogAnalytics(string operation,
IEnumerable<ProjectObject> projects = null,
IEnumerable<ResourceObject> resources = null,
......
......@@ -61,26 +61,35 @@
<Reference Include="Coscine.Configuration, Version=1.5.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Configuration.1.5.0\lib\net461\Coscine.Configuration.dll</HintPath>
</Reference>
<Reference Include="Coscine.Database, Version=1.24.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.24.0\lib\net461\Coscine.Database.dll</HintPath>
<Reference Include="Coscine.Database, Version=1.25.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.25.0\lib\net461\Coscine.Database.dll</HintPath>
</Reference>
<Reference Include="Coscine.Database.T4, Version=1.24.0.0, Culture=neutral, PublicKeyToken=84b4c404a0696261, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.24.0\lib\net461\Coscine.Database.T4.dll</HintPath>
<Reference Include="Coscine.Database.T4, Version=1.25.0.0, Culture=neutral, PublicKeyToken=84b4c404a0696261, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.25.0\lib\net461\Coscine.Database.T4.dll</HintPath>
</Reference>
<Reference Include="Coscine.Logging, Version=1.2.0.0, Culture=neutral, PublicKeyToken=e1ed402bc3f6525e, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Logging.1.2.0\lib\net461\Coscine.Logging.dll</HintPath>
</Reference>
<Reference Include="Coscine.Metadata, Version=1.3.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Metadata.1.3.2\lib\net461\Coscine.Metadata.dll</HintPath>
</Reference>
<Reference Include="Coscine.ProxyApi, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.ProxyApi.1.2.1\lib\net461\Coscine.ProxyApi.dll</HintPath>
</Reference>
<Reference Include="dotNetRDF, Version=2.5.0.0, Culture=neutral, PublicKeyToken=6055ffe4c97cc780, processorArchitecture=MSIL">
<HintPath>..\packages\dotNetRDF.2.5.0\lib\net40\dotNetRDF.dll</HintPath>
</Reference>
<Reference Include="dotNetRDF.Data.Virtuoso, Version=2.5.0.0, Culture=neutral, PublicKeyToken=6055ffe4c97cc780, processorArchitecture=MSIL">
<HintPath>..\packages\dotNetRDF.Data.Virtuoso.2.5.0\lib\net40\dotNetRDF.Data.Virtuoso.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<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>
</Reference>
<Reference Include="HtmlAgilityPack, Version=1.8.2.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlAgilityPack.1.8.2\lib\Net45\HtmlAgilityPack.dll</HintPath>
<Reference Include="HtmlAgilityPack, Version=1.11.17.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlAgilityPack.1.11.17\lib\Net45\HtmlAgilityPack.dll</HintPath>
</Reference>
<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>
......
......@@ -7,11 +7,14 @@
<package id="Coscine.Action" version="1.15.1" targetFramework="net472" />
<package id="Coscine.ApiCommons" version="1.9.1" targetFramework="net472" />
<package id="Coscine.Configuration" version="1.5.0" targetFramework="net472" />
<package id="Coscine.Database" version="1.24.0" targetFramework="net472" />
<package id="Coscine.Database" version="1.25.0" targetFramework="net472" />
<package id="Coscine.Logging" version="1.2.0" targetFramework="net472" />
<package id="Coscine.Metadata" version="1.3.2" targetFramework="net472" />
<package id="Coscine.ProxyApi" version="1.2.1" targetFramework="net472" />
<package id="dotNetRDF" version="2.5.0" targetFramework="net472" />
<package id="dotNetRDF.Data.Virtuoso" version="2.5.0" 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.SqlServer" version="2.6.4" targetFramework="net472" />
<package id="linq2db.t4models" version="2.6.4" targetFramework="net472" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment