Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • Fix/xxxx-updateDependencies
  • Hotfix/0071-fixResourceCreate
  • Hotfix/1035-fixResourceApi
  • Hotfix/1360-databaseScaffolding
  • Hotfix/1383-topLevel
  • Hotfix/1383-topLevelAlternative
  • Hotfix/1433-defaultQuota
  • Hotfix/1796-projectDdos
  • Hotfix/2087-efNet6
  • Hotfix/64-releaseUDE
  • Hotfix/73-fixResourceCreateRDS
  • Issue/1321-pidEnquiryOverhaul
  • Issue/1788-extractionCronjob
  • Issue/1866-ExtendResourceTypeConfigurationTUDo
  • Issue/1867-addNewResourceTypes
  • Issue/1877-ExtendResourceTypeConfigurationNRWFHs
  • Issue/1878-addNewResourceTypes
  • Issue/1910-MigrationtoNET6.0
  • Issue/1913-ModificationsResourceMetadata
  • Issue/1951-quotaImplementation
  • Issue/1999-gitlabResourcesLib
  • Issue/2072-wormResourceType
  • Issue/2101-gitLabResTypeUi
  • Issue/2102-gitLabResTypeRCV
  • Issue/2183-kpiGeneratorResource
  • Issue/2221-projectDateCreated
  • Issue/2222-resourceDateCreated
  • Issue/2278-gitlabToS
  • Issue/2287-guestRole
  • Issue/2309-docs
  • Issue/2364-testingKpiParser
  • Issue/2449-GuidPidSlugToProjectSettings
  • Issue/3003-stsInstitute
  • Issues/0028-maxQuotaFix
  • Product/1100-fdsS3
  • Product/1149-dfnaai
  • Product/1154-resourceTypeDefinition
  • Product/1188-LoggingExtended
  • Product/1287-dotnet5Sharepoint
  • Product/1414-fhPrivileges
  • Product/1470-migrationForArchiving
  • Product/1573-ReadOnlyResources
  • Product/1629-onboardingOtherUniversities
  • Product/202-userInvitation
  • Product/407-net5migration
  • Product/704-basicReporting
  • Product/789-userContactEmail
  • Product/903-ApiTokens
  • Sprint/2020-20
  • Sprint/2020-22
  • Sprint/2021-01
  • Sprint/2021-03
  • Sprint/2021-04
  • Sprint/2021-05
  • Sprint/2021-08
  • Sprint/2021-10
  • Sprint/2021-11
  • Sprint/2021-15
  • Sprint/2021-19
  • Sprint/2022-01
  • Test/xxxx-pipelineTriggers
  • Topic/1051-basicReporting
  • Topic/1125-apiTokens
  • Topic/1159-rtdApi
  • Topic/1221-LogginExtendedNew
  • Topic/1221-LoggingExtended
  • Topic/1226-databaseLibraryMigration
  • Topic/1278-dfnAAI
  • Topic/1286-dotnet5Database
  • Topic/1292-FdsS3
  • Topic/1294-contactChangeFunctionality
  • Topic/1425-fhPrivileges
  • Topic/1453-userInvitation
  • Topic/1556-migrationForArchiving
  • Topic/1597-AddArchiveFlagInResourceObject
  • Topic/1711-extendResourceTypeConfiguration
  • Topic/1714-newResourceTypesUDE
  • dev
  • gitkeep
  • master
  • v1.0.0
  • v1.1.0
  • v1.10.0
  • v1.11.0
  • v1.12.0
  • v1.12.1
  • v1.13.0
  • v1.14.0
  • v1.15.0
  • v1.15.1
  • v1.16.0
  • v1.17.0
  • v1.18.0
  • v1.19.0
  • v1.2.0
  • v1.2.1
  • v1.2.2
  • v1.20.0
  • v1.21.0
  • v1.22.0
  • v1.22.1
  • v1.22.2
  • v1.23.0
  • v1.24.0
  • v1.25.0
  • v1.25.1
  • v1.26.0
  • v1.27.0
  • v1.27.1
  • v1.28.0
  • v1.3.0
  • v1.4.0
  • v1.5.0
  • v1.5.1
  • v1.6.0
  • v1.7.0
  • v1.8.0
  • v1.9.0
  • v2.0.0
  • v2.0.1
  • v2.1.0
  • v2.1.1
  • v2.10.0
  • v2.10.1
  • v2.11.0
  • v2.11.1
  • v2.12.0
  • v2.12.1
  • v2.13.0
  • v2.14.0
  • v2.15.0
  • v2.16.0
  • v2.16.1
  • v2.16.2
  • v2.17.0
  • v2.18.0
  • v2.19.0
  • v2.19.1
  • v2.2.0
  • v2.2.1
  • v2.20.0
  • v2.22.0
  • v2.3.0
  • v2.4.0
  • v2.4.1
  • v2.5.0
  • v2.6.0
  • v2.7.0
  • v2.7.1
  • v2.7.2
  • v2.7.3
  • v2.8.0
  • v2.9.0
  • v2.9.1
154 results

Target

Select target project
  • coscine/backend/libraries/database
1 result
Select Git revision
  • Fix/xxxx-updateDependencies
  • Hotfix/0071-fixResourceCreate
  • Hotfix/1035-fixResourceApi
  • Hotfix/1360-databaseScaffolding
  • Hotfix/1383-topLevel
  • Hotfix/1383-topLevelAlternative
  • Hotfix/1433-defaultQuota
  • Hotfix/1796-projectDdos
  • Hotfix/2087-efNet6
  • Hotfix/64-releaseUDE
  • Hotfix/73-fixResourceCreateRDS
  • Issue/1321-pidEnquiryOverhaul
  • Issue/1788-extractionCronjob
  • Issue/1866-ExtendResourceTypeConfigurationTUDo
  • Issue/1867-addNewResourceTypes
  • Issue/1877-ExtendResourceTypeConfigurationNRWFHs
  • Issue/1878-addNewResourceTypes
  • Issue/1910-MigrationtoNET6.0
  • Issue/1913-ModificationsResourceMetadata
  • Issue/1951-quotaImplementation
  • Issue/1999-gitlabResourcesLib
  • Issue/2072-wormResourceType
  • Issue/2101-gitLabResTypeUi
  • Issue/2102-gitLabResTypeRCV
  • Issue/2183-kpiGeneratorResource
  • Issue/2221-projectDateCreated
  • Issue/2222-resourceDateCreated
  • Issue/2278-gitlabToS
  • Issue/2287-guestRole
  • Issue/2309-docs
  • Issue/2364-testingKpiParser
  • Issue/2449-GuidPidSlugToProjectSettings
  • Issue/3003-stsInstitute
  • Issues/0028-maxQuotaFix
  • Product/1100-fdsS3
  • Product/1149-dfnaai
  • Product/1154-resourceTypeDefinition
  • Product/1188-LoggingExtended
  • Product/1287-dotnet5Sharepoint
  • Product/1414-fhPrivileges
  • Product/1470-migrationForArchiving
  • Product/1573-ReadOnlyResources
  • Product/1629-onboardingOtherUniversities
  • Product/202-userInvitation
  • Product/407-net5migration
  • Product/704-basicReporting
  • Product/789-userContactEmail
  • Product/903-ApiTokens
  • Sprint/2020-20
  • Sprint/2020-22
  • Sprint/2021-01
  • Sprint/2021-03
  • Sprint/2021-04
  • Sprint/2021-05
  • Sprint/2021-08
  • Sprint/2021-10
  • Sprint/2021-11
  • Sprint/2021-15
  • Sprint/2021-19
  • Sprint/2022-01
  • Test/xxxx-pipelineTriggers
  • Topic/1051-basicReporting
  • Topic/1125-apiTokens
  • Topic/1159-rtdApi
  • Topic/1221-LogginExtendedNew
  • Topic/1221-LoggingExtended
  • Topic/1226-databaseLibraryMigration
  • Topic/1278-dfnAAI
  • Topic/1286-dotnet5Database
  • Topic/1292-FdsS3
  • Topic/1294-contactChangeFunctionality
  • Topic/1425-fhPrivileges
  • Topic/1453-userInvitation
  • Topic/1556-migrationForArchiving
  • Topic/1597-AddArchiveFlagInResourceObject
  • Topic/1711-extendResourceTypeConfiguration
  • Topic/1714-newResourceTypesUDE
  • dev
  • gitkeep
  • master
  • v1.0.0
  • v1.1.0
  • v1.10.0
  • v1.11.0
  • v1.12.0
  • v1.12.1
  • v1.13.0
  • v1.14.0
  • v1.15.0
  • v1.15.1
  • v1.16.0
  • v1.17.0
  • v1.18.0
  • v1.19.0
  • v1.2.0
  • v1.2.1
  • v1.2.2
  • v1.20.0
  • v1.21.0
  • v1.22.0
  • v1.22.1
  • v1.22.2
  • v1.23.0
  • v1.24.0
  • v1.25.0
  • v1.25.1
  • v1.26.0
  • v1.27.0
  • v1.27.1
  • v1.28.0
  • v1.3.0
  • v1.4.0
  • v1.5.0
  • v1.5.1
  • v1.6.0
  • v1.7.0
  • v1.8.0
  • v1.9.0
  • v2.0.0
  • v2.0.1
  • v2.1.0
  • v2.1.1
  • v2.10.0
  • v2.10.1
  • v2.11.0
  • v2.11.1
  • v2.12.0
  • v2.12.1
  • v2.13.0
  • v2.14.0
  • v2.15.0
  • v2.16.0
  • v2.16.1
  • v2.16.2
  • v2.17.0
  • v2.18.0
  • v2.19.0
  • v2.19.1
  • v2.2.0
  • v2.2.1
  • v2.20.0
  • v2.22.0
  • v2.3.0
  • v2.4.0
  • v2.4.1
  • v2.5.0
  • v2.6.0
  • v2.7.0
  • v2.7.1
  • v2.7.2
  • v2.7.3
  • v2.8.0
  • v2.9.0
  • v2.9.1
154 results
Show changes
Commits on Source (3)
......@@ -4,7 +4,7 @@
<RootNamespace>Coscine.Database</RootNamespace>
<AssemblyName>Coscine.Database</AssemblyName>
<TargetFrameworks>net5.0;net461</TargetFrameworks>
<Version>2.7.1</Version>
<Version>2.7.2</Version>
</PropertyGroup>
<PropertyGroup>
<Authors>RWTH Aachen University</Authors>
......
......@@ -19,7 +19,7 @@ namespace Coscine.Database.Models
return
(from tableEntry in GetITableFromDatabase(db)
where tableEntry.Id == id
&& tableEntry.Deleted == true
&& tableEntry.Deleted
select tableEntry).Count() == 1;
});
}
......@@ -32,7 +32,7 @@ namespace Coscine.Database.Models
return
(from tableEntry in GetITableFromDatabase(db).AsExpandable()
where expression.Invoke(tableEntry) == id
&& tableEntry.Deleted == false
&& !tableEntry.Deleted
select tableEntry).FirstOrDefault();
});
}
......@@ -61,7 +61,7 @@ namespace Coscine.Database.Models
return
(from tableEntry in GetITableFromDatabase(db).AsExpandable()
where whereClause.Invoke(tableEntry)
&& tableEntry.Deleted == false
&& !tableEntry.Deleted
select tableEntry).FirstOrDefault();
});
}
......@@ -72,7 +72,7 @@ namespace Coscine.Database.Models
{
return
(from tableEntry in GetITableFromDatabase(db)
where tableEntry.Deleted == false
where !tableEntry.Deleted
select tableEntry).ToList();
});
}
......@@ -84,7 +84,7 @@ namespace Coscine.Database.Models
return
(from tableEntry in GetITableFromDatabase(db).AsExpandable()
where whereClause.Invoke(tableEntry)
&& tableEntry.Deleted == false
&& !tableEntry.Deleted
select tableEntry).ToList();
});
}
......@@ -107,18 +107,12 @@ namespace Coscine.Database.Models
public override int Delete(Project databaseObject)
{
databaseObject.Deleted = true;
return DatabaseConnection.ConnectToDatabase((db) =>
{
return (int)db.Update(databaseObject).State;
});
return DatabaseConnection.ConnectToDatabase((db) => (int)db.Update(databaseObject).State);
}
public int HardDelete(Project databaseObject)
{
return DatabaseConnection.ConnectToDatabase((db) =>
{
return (int) db.Remove(databaseObject).State;
});
return DatabaseConnection.ConnectToDatabase((db) => (int)db.Remove(databaseObject).State);
}
public int HardDelete(Expression<Func<Project, bool>> whereClause)
......@@ -177,7 +171,7 @@ namespace Coscine.Database.Models
join pi in db.ProjectInstitutes on p.Id equals pi.ProjectId into joinedPi
from jpi in joinedPi.DefaultIfEmpty()
where p.Deleted == false
where !p.Deleted
group jpi by jpi.OrganizationUrl into g
select new OrganizationCountObject(g.Key, g.Count())).ToList();
});
......@@ -189,8 +183,8 @@ namespace Coscine.Database.Models
var slug = projectObject.DisplayName;
slug = slug.ToLower();
slug = Regex.Replace(slug, @"[\s-]+", "-");
slug = Regex.Replace(slug, @"[^a-z0-9-]*|", "");
slug = Regex.Replace(slug, @"^-|-$", "");
slug = Regex.Replace(slug, "[^a-z0-9-]*|", "");
slug = Regex.Replace(slug, "^-|-$", "");
Random r = new Random();
int rInt = r.Next(0, 9000000) + 1000000;
......@@ -211,7 +205,7 @@ namespace Coscine.Database.Models
while (GetBySlug(fullSlug + rInt) != null)
{
rInt++;
};
}
fullSlug += rInt;
}
......@@ -333,11 +327,11 @@ namespace Coscine.Database.Models
public IEnumerable<Project> GetTopLevelWithAccess(User user, params string[] allowedAccess)
{
return GetWithAccess(user, allowedAccess, (allowedProjectIds) => GetAllWhere((project) =>
return GetWithAccess(user, allowedAccess, (_) => GetAllWhere((project) =>
(
// all accessable projects that have no parents
(!project.SubProjectSubProjectNavigations.Any())
|| // all accessable projects that have no accessable parents
// all accessible projects that have no parents
(project.SubProjectSubProjectNavigations.Count == 0)
|| // all accessible projects that have no accessible parents
(
project.SubProjectSubProjectNavigations.All(
(parentProjects) =>
......@@ -436,7 +430,7 @@ namespace Coscine.Database.Models
{
list = GetAllWhere((dbProject) => (from subProject in dbProject.SubProjectProjects
where subProject.SubProjectId == currentProject.Id
&& subProject.Project.Deleted == false
&& !subProject.Project.Deleted
select subProject).Any());
if (list.Any())
......@@ -530,6 +524,5 @@ namespace Coscine.Database.Models
}
return $"{counted}/{maxCount}";
}
}
}
\ No newline at end of file
......@@ -25,13 +25,15 @@ namespace Coscine.Database.Models
public Dictionary<string, string> GetResourceTypeOptions(Guid id)
{
var dictionary = new Dictionary<string, string>();
var resourceType = GetById(id);
dictionary.Add("accessKey", resourceType.AccessKey);
dictionary.Add("secretKey", resourceType.SecretKey);
dictionary.Add("bucketname", resourceType.BucketName);
dictionary.Add("endpoint", resourceType.Endpoint);
dictionary.Add("size", $"{resourceType.Size}");
var dictionary = new Dictionary<string, string>
{
{ "accessKey", resourceType.AccessKey },
{ "secretKey", resourceType.SecretKey },
{ "bucketname", resourceType.BucketName },
{ "endpoint", resourceType.Endpoint },
{ "size", $"{resourceType.Size}" }
};
return dictionary;
}
}
......
......@@ -24,17 +24,19 @@ namespace Coscine.Database.Models
public Dictionary<string, string> GetResourceTypeOptions(Guid id)
{
var dictionary = new Dictionary<string, string>();
var resourceType = GetById(id);
dictionary.Add("accessKey", resourceType.AccessKey);
dictionary.Add("secretKey", resourceType.SecretKey);
dictionary.Add("accessKeyRead", resourceType.AccessKeyRead);
dictionary.Add("secretKeyRead", resourceType.SecretKeyRead);
dictionary.Add("accessKeyWrite", resourceType.AccessKeyWrite);
dictionary.Add("secretKeyWrite", resourceType.SecretKeyWrite);
dictionary.Add("bucketname", resourceType.BucketName);
dictionary.Add("endpoint", resourceType.Endpoint);
dictionary.Add("size", $"{resourceType.Size}");
var dictionary = new Dictionary<string, string>
{
{ "accessKey", resourceType.AccessKey },
{ "secretKey", resourceType.SecretKey },
{ "accessKeyRead", resourceType.AccessKeyRead },
{ "secretKeyRead", resourceType.SecretKeyRead },
{ "accessKeyWrite", resourceType.AccessKeyWrite },
{ "secretKeyWrite", resourceType.SecretKeyWrite },
{ "bucketname", resourceType.BucketName },
{ "endpoint", resourceType.Endpoint },
{ "size", $"{resourceType.Size}" }
};
return dictionary;
}
}
......
......@@ -14,6 +14,15 @@ namespace Coscine.Database.Models
public class ResourceModel : DatabaseModel<Resource>
{
private readonly IConfiguration _configuration = new ConsulConfiguration();
private static readonly Dictionary<string, string> _configs = new Dictionary<string, string>
{
{ "rds", "coscine/global/rds/ecs-rwth/rds" },
{ "rdsude", "coscine/global/rds/ecs-ude/rds" },
{ "rdss3", "coscine/global/rds/ecs-rwth/rds-s3" },
{ "rdss3ude", "coscine/global/rds/ecs-ude/rds-s3" }
};
public Resource StoreFromObject(ResourceObject resourceObject)
{
if (!resourceObject.Disciplines.Any() || resourceObject.ResourceTypeOption == null)
......@@ -48,7 +57,7 @@ namespace Coscine.Database.Models
}
catch (Exception)
{
// Makes sure to delete all FK refrences, otherwise a delete is not possible
// Makes sure to delete all FK references, otherwise a delete is not possible
DeleteResource(resource);
throw;
}
......@@ -100,7 +109,7 @@ namespace Coscine.Database.Models
join rt in db.ResourceTypes on r.TypeId equals rt.Id into joinedRt
from jrt in joinedRt.DefaultIfEmpty()
where jp.Deleted == false &&
where !jp.Deleted &&
IsLikeRds(jrt.DisplayName)
group r by jpi.OrganizationUrl into g
select new OrganizationResourceListObject(g.Key, g.ToList())).ToList();
......@@ -120,13 +129,14 @@ namespace Coscine.Database.Models
}
else
{
var prefix = _configs[resource.Type.DisplayName];
RdsresourceType rdsResourceType = new RdsresourceType()
{
BucketName = resource.Id.ToString(),
Size = rdsResourceTypeObject.Size,
AccessKey = _configuration.GetString("coscine/global/rds/ecs-rwth/rds/object_user_name"),
SecretKey = _configuration.GetString("coscine/global/rds/ecs-rwth/rds/object_user_secretkey"),
Endpoint = _configuration.GetString("coscine/global/rds/ecs-rwth/rds/s3_endpoint"),
AccessKey = _configuration.GetString($"{prefix}/object_user_name"),
SecretKey = _configuration.GetString($"{prefix}/object_user_secretkey"),
Endpoint = _configuration.GetString($"{prefix}/s3_endpoint"),
};
rdsResourceTypeModel.Insert(rdsResourceType);
resource.ResourceTypeOptionId = rdsResourceType.Id;
......@@ -209,16 +219,17 @@ namespace Coscine.Database.Models
}
else
{
var prefix = _configs[resource.Type.DisplayName];
var rdsS3ResourceType = new RdsS3resourceType()
{
BucketName = resource.Id.ToString(),
AccessKey = _configuration.GetString("coscine/global/rds/ecs-rwth/rds-s3/object_user_name"),
SecretKey = _configuration.GetString("coscine/global/rds/ecs-rwth/rds-s3/object_user_secretkey"),
AccessKey = _configuration.GetString($"{prefix}/object_user_name"),
SecretKey = _configuration.GetString($"{prefix}/object_user_secretkey"),
AccessKeyRead = $"read_{resource.Id}",
SecretKeyRead = RandomHelper.GenerateRandomChunk(32),
AccessKeyWrite = $"write_{resource.Id}",
SecretKeyWrite = RandomHelper.GenerateRandomChunk(32),
Endpoint = _configuration.GetString("coscine/global/rds/ecs-rwth/rds-s3/s3_endpoint"),
Endpoint = _configuration.GetString($"{prefix}/s3_endpoint"),
Size = rdsS3ResourceTypeObject.Size,
};
rdsS3ResourceTypeModel.Insert(rdsS3ResourceType);
......@@ -418,7 +429,6 @@ namespace Coscine.Database.Models
LinkedResourceTypeModel linkedResourceTypeModel = new LinkedResourceTypeModel();
var linkedResourceType = linkedResourceTypeModel.GetById(resource.ResourceTypeOptionId.Value);
resourceTypeOptionObject = new LinkedResourceTypeObject(linkedResourceType.Id);
}
else if (IsLikeRdsS3(resource.Type.DisplayName) && resource.ResourceTypeOptionId != null)
{
......@@ -451,7 +461,7 @@ namespace Coscine.Database.Models
resourceTypeOptionObject == null ? new JObject() : JObject.FromObject(resourceTypeOptionObject),
resource.ApplicationProfile,
JToken.Parse(resource.FixedValues ?? "{}"),
(resource.Creator != null) ? resource.Creator : null,
resource.Creator,
resource.Archived == "1"
);
}
......