diff --git a/src/OrganizationLoader/Program.cs b/src/OrganizationLoader/Program.cs index 2096ec2536694b79563aa75751d7a95f614ed200..04e857b84fdb84e8be5c807b2608a90deabab7ed 100644 --- a/src/OrganizationLoader/Program.cs +++ b/src/OrganizationLoader/Program.cs @@ -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("]."); } diff --git a/src/OrganizationLoader/ResourceType.cs b/src/OrganizationLoader/ResourceType.cs index 50459db475dda66f7ae3c29f034965ecc068da94..89d91fb55f28d6e5598ac75ca2a6bcd32d66b0a1 100644 --- a/src/OrganizationLoader/ResourceType.cs +++ b/src/OrganizationLoader/ResourceType.cs @@ -4,6 +4,7 @@ { public string Name { get; set; } public int Quota { get; set; } + public int MaxQuota { get; set; } public bool HasQuota { get; set; } } }