Skip to content
Snippets Groups Projects

Update: Added max quota and fix for change field (rpdm/issues#28)

Merged L. Ellenbeck requested to merge Issues/0028-maxQuotaFix into Sprint/2021-19
2 files
+ 21
15
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -16,37 +16,40 @@ namespace Coscine.OrganizationLoader
{
private static HttpClient _httpClient;
private static readonly List<ResourceType> _resourceTypes = new List<ResourceType>
{
private static readonly List<ResourceType> _resourceTypes = new List<ResourceType>
{
new ResourceType
{
Name ="rds",
{
Name ="rds",
Quota = 25,
MaxQuota = 100,
HasQuota = true,
},
new ResourceType
{ Name ="rdss3",
Quota = 0,
MaxQuota = 0,
HasQuota = true,
},
new ResourceType
{ Name = "linked",
Quota = -1,
MaxQuota = -1,
HasQuota = false,
},
};
// taken from https://tools.aai.dfn.de/entities/ and https://git.rwth-aachen.de/coscine/graphs/organizations/-/raw/master/ROR/index.ttl
private static readonly List<OrganizationMapping> _organizationMappings = new List<OrganizationMapping>
{
new OrganizationMapping
{
RorId = "https://ror.org/04xfq0f34",
private static readonly List<OrganizationMapping> _organizationMappings = new List<OrganizationMapping>
{
new OrganizationMapping
{
RorId = "https://ror.org/04xfq0f34",
EntityId = "https://login.rz.rwth-aachen.de/shibboleth",
},
new OrganizationMapping
{
RorId = "https://ror.org/04xfq0f34",
RorId = "https://ror.org/04xfq0f34",
EntityId = "https://login-test.rz.rwth-aachen.de/shibboleth",
},
};
@@ -107,7 +110,7 @@ namespace Coscine.OrganizationLoader
Console.WriteLine("Forced execution! Checks will be skipped.");
}
if(string.IsNullOrWhiteSpace(output))
if (string.IsNullOrWhiteSpace(output))
{
Console.WriteLine("No value for output provided.");
return;
@@ -116,7 +119,7 @@ namespace Coscine.OrganizationLoader
var configuration = new ConsulConfiguration();
rorId = string.IsNullOrWhiteSpace(rorId) ? configuration.GetString("coscine/global/organizations/rwth/ror_url") : rorId;
if(string.IsNullOrWhiteSpace(rorId))
if (string.IsNullOrWhiteSpace(rorId))
{
Console.WriteLine("No value for rorId provided.");
}
@@ -198,7 +201,7 @@ namespace Coscine.OrganizationLoader
var organizationsSha = Sha256Hash(organizationsString);
var employeesSha = Sha256Hash(employeesString);
if(!force && previousEmployeeSha != null && previousEmployeeSha == employeesSha && previousOrganizationsSha != null && previousOrganizationsSha == organizationsSha)
if (!force && previousEmployeeSha != null && previousEmployeeSha == employeesSha && previousOrganizationsSha != null && previousOrganizationsSha == organizationsSha)
{
Console.WriteLine("The sha of the exports has not changed.");
return;
@@ -292,7 +295,8 @@ namespace Coscine.OrganizationLoader
new Organization
{
OrgId = node["OrgId"].InnerText?.Trim(),
Name = node["Name"].InnerText?.Trim(),
// IDM changed this to capital and might change it back. Keeps us safe for now.
Name = (node["NAME"] ?? node["Name"]).InnerText?.Trim(),
IKZ = node["IKZ"].InnerText?.Trim(),
Abbreviation = node["Abbreviation"]?.InnerText?.Trim(),
CMSLink = node["CMSLink"].InnerText?.Trim(),
@@ -377,9 +381,10 @@ namespace Coscine.OrganizationLoader
{
streamWriter.WriteLine($"<{rorId}> coscineresource:typeSpecification [");
streamWriter.WriteLine($@" coscineresource:type <https://purl.org/coscine/terms/resource/types#{resourceType.Name}>;");
if(resourceType.HasQuota)
if (resourceType.HasQuota)
{
streamWriter.WriteLine($@" coscineresource:defaultQuota ""{resourceType.Quota}"";");
streamWriter.WriteLine($@" coscineresource:defaultMaxQuota ""{resourceType.MaxQuota}"";");
}
streamWriter.WriteLine("].");
}
Loading