Skip to content

Commit da4b373

Browse files
authored
Merge pull request #2162 from BEXIS2/rc
Rc
2 parents 47cadc0 + b7b0d98 commit da4b373

File tree

149 files changed

+9207
-4522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+9207
-4522
lines changed

BExIS++.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1582,8 +1582,8 @@ Global
15821582
{9BFFFD11-03C6-47DF-9CC9-F458A9A49377} = {F3354AC7-CDA1-44E2-8E85-8DB532ED8C75}
15831583
EndGlobalSection
15841584
GlobalSection(ExtensibilityGlobals) = postSolution
1585-
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35;packages\Unity.2.1.505.2\lib\NET35
15861585
SolutionGuid = {9B6E4921-8EBA-487D-A098-3E473A0EAC64}
1586+
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35;packages\Unity.2.1.505.2\lib\NET35
15871587
EndGlobalSection
15881588
GlobalSection(SubversionScc) = preSolution
15891589
Svn-Managed = True

CITATION.cff

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
cff-version: 1.2.0
2+
message: "If you use BEXIS2 in your research, please cite it using the following metadata."
3+
title: "BEXIS2"
4+
version: 4.1.0
5+
date-released: 15.08.2025
6+
authors:
7+
- family-names: "Zander"
8+
given-names: "Franziska"
9+
orcid: "https://orcid.org/0000-0001-6892-7046"
10+
- family-names: "Schöne"
11+
given-names: "David"
12+
orcid: "https://orcid.org/0009-0009-4663-8716"
13+
- family-names: "Thiel"
14+
given-names: "Sven"
15+
orcid: "https://orcid.org/0000-0003-3093-5635"
16+
- family-names: "Hohmuth"
17+
given-names: "Martin"
18+
orcid: "https://orcid.org/0000-0001-7492-3631"
19+
- family-names: "König-Ries"
20+
given-names: "Birgitta"
21+
orcid: "https://orcid.org/0000-0002-2382-9722"
22+
doi: ..
23+
url: "https://github.com/BEXIS2/Core"
24+
license: "LGPL-3.0 license"
25+
type: software
26+
keywords:
27+
- research data management
28+
- data repository
29+
- data infrastructure
30+
- open source

Components/AAA/BExIS.Security.Services/Authentication/LdapAuthenticationManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace BExIS.Security.Services.Authentication
1212
{
13-
public class LdapAuthenticationManager
13+
public class LdapAuthenticationManager : IDisposable
1414
{
1515
private readonly IUnitOfWork _guow;
1616
private bool _isDisposed;

Components/AAA/BExIS.Security.Services/Authentication/SignInManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ namespace BExIS.Security.Services.Authentication
88
public sealed class SignInManager : SignInManager<User, long>
99
{
1010
[System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Justification = "<Ausstehend>")]
11-
public SignInManager(IAuthenticationManager authenticationManager)
12-
: base(new IdentityUserService(), authenticationManager)
11+
public SignInManager(IAuthenticationManager authenticationManager, UserManager userManager)
12+
: base(new IdentityUserService(userManager), authenticationManager)
1313
{
1414
}
1515
}

Components/AAA/BExIS.Security.Services/Subjects/GroupManager.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using BExIS.Security.Entities.Subjects;
1+
using BExIS.Security.Entities.Authorization;
2+
using BExIS.Security.Entities.Subjects;
23
using BExIS.Utils.NH.Querying;
34
using Microsoft.AspNet.Identity;
45
using System;
@@ -116,6 +117,45 @@ public Task DeleteAsync(Group role)
116117
return Task.CompletedTask;
117118
}
118119

120+
public Task<bool> DeleteByIdAsync(long roleId)
121+
{
122+
var groupRepository = _guow.GetRepository<Group>();
123+
var group = groupRepository.Get(roleId);
124+
125+
if (group == null)
126+
//return Task.FromException(new Exception());
127+
return Task.FromResult(false);
128+
129+
130+
// Users
131+
var userRepository = _guow.GetRepository<User>();
132+
foreach (var user in group.Users)
133+
{
134+
user.Groups.Remove(group);
135+
userRepository.Put(user);
136+
}
137+
138+
// EntityPermissions
139+
var entityPermissionRepository = _guow.GetRepository<EntityPermission>();
140+
foreach (var entityPermission in entityPermissionRepository.Get(e => e.Subject.Id == roleId))
141+
{
142+
entityPermissionRepository.Delete(entityPermission);
143+
}
144+
145+
// FeaturePermissions
146+
var featurePermissionRepository = _guow.GetRepository<FeaturePermission>();
147+
foreach (var featurePermission in featurePermissionRepository.Get(e => e.Subject.Id == roleId))
148+
{
149+
featurePermissionRepository.Delete(featurePermission);
150+
}
151+
152+
var result = groupRepository.Delete(group);
153+
154+
_guow.Commit();
155+
156+
return Task.FromResult(result);
157+
}
158+
119159
public void Dispose()
120160
{
121161
this.Dispose(true);
Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,49 @@
11
using BExIS.Security.Entities.Subjects;
2+
using BExIS.Utils.NH.Querying;
23
using Microsoft.AspNet.Identity;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Threading.Tasks;
37

48
namespace BExIS.Security.Services.Subjects
59
{
610
public class IdentityGroupService : RoleManager<Group, long>
711
{
8-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Justification = "<Ausstehend>")]
9-
public IdentityGroupService() : base(new GroupManager())
12+
private readonly GroupManager _groupManager;
13+
private bool _disposed;
14+
15+
//[System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Justification = "<Ausstehend>")]
16+
public IdentityGroupService(GroupManager groupManager) : base(groupManager)
1017
{
18+
_groupManager = groupManager ?? throw new ArgumentNullException(nameof(groupManager));
19+
1120
RoleValidator = new RoleValidator<Group, long>(this)
1221
{
1322
};
1423
}
1524

25+
public Task<bool> DeleteByIdAsync(long roleId)
26+
{
27+
return _groupManager.DeleteByIdAsync(roleId);
28+
}
29+
30+
public List<Group> GetGroups(FilterExpression filter, OrderByExpression orderBy, int pageNumber, int pageSize, out int count)
31+
{
32+
return _groupManager.GetGroups(filter, orderBy, pageNumber, pageSize, out count);
33+
}
1634
protected override void Dispose(bool disposing)
1735
{
36+
if (!_disposed)
37+
{
38+
if (disposing)
39+
{
40+
_groupManager?.Dispose();
41+
}
42+
43+
_disposed = true;
44+
}
45+
1846
base.Dispose(disposing);
19-
Store.Dispose();
2047
}
2148
}
2249
}

Components/AAA/BExIS.Security.Services/Subjects/IdentityUserService.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ namespace BExIS.Security.Services.Subjects
99
{
1010
public class IdentityUserService : UserManager<User, long>
1111
{
12-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Justification = "<Ausstehend>")]
13-
public IdentityUserService() : base(new UserManager())
12+
private readonly UserManager _userManager;
13+
private bool _disposed;
14+
15+
//[System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Justification = "<Ausstehend>")]
16+
public IdentityUserService(UserManager userManager) : base(userManager)
1417
{
18+
_userManager = userManager;
19+
1520
// Configure validation logic for usernames
1621
UserValidator = new UserValidator<User, long>(this)
1722
{
@@ -54,8 +59,17 @@ public IdentityUserService() : base(new UserManager())
5459

5560
protected override void Dispose(bool disposing)
5661
{
62+
if (!_disposed)
63+
{
64+
if (disposing)
65+
{
66+
_userManager?.Dispose();
67+
}
68+
69+
_disposed = true;
70+
}
71+
5772
base.Dispose(disposing);
58-
Store.Dispose();
5973
}
6074
}
6175
}

Components/AAA/BExIS.Security.Services/Subjects/UserManager.cs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using BExIS.Security.Entities.Authentication;
2+
using BExIS.Security.Entities.Authorization;
23
using BExIS.Security.Entities.Subjects;
34
using BExIS.Utils.NH.Querying;
45
using Microsoft.AspNet.Identity;
@@ -115,12 +116,34 @@ public Task DeleteAsync(User user)
115116
return Task.CompletedTask;
116117
}
117118

118-
public Task DeleteByIdAsync(long userId)
119+
public Task<bool> DeleteByIdAsync(long userId)
119120
{
120-
_guow.GetRepository<User>().Delete(userId);
121+
var userRepository = _guow.GetRepository<User>();
122+
var user = userRepository.Get(userId);
123+
124+
if(user == null)
125+
//return Task.FromException(new Exception());
126+
return Task.FromResult(false);
127+
128+
// EntityPermissions
129+
var entityPermissionRepository = _guow.GetRepository<EntityPermission>();
130+
foreach (var entityPermission in entityPermissionRepository.Get(e => e.Subject.Id == userId))
131+
{
132+
entityPermissionRepository.Delete(entityPermission);
133+
}
134+
135+
// FeaturePermissions
136+
var featurePermissionRepository = _guow.GetRepository<FeaturePermission>();
137+
foreach (var featurePermission in featurePermissionRepository.Get(e => e.Subject.Id == userId))
138+
{
139+
featurePermissionRepository.Delete(featurePermission);
140+
}
141+
142+
var result = userRepository.Delete(user);
143+
121144
_guow.Commit();
122145

123-
return Task.CompletedTask;
146+
return Task.FromResult(result);
124147
}
125148

126149
public void Dispose()

Components/AAA/BExIS.Security.Services/Utilities/MessageHelper.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ public static string GetDeleteDatasetMessage(long datasetid, string userName, st
3838
return message + ".";
3939
}
4040

41+
public static string GetUndoDeleteDatasetHeader(long datasetid, string entityname)
42+
{
43+
return $"{entityname}: Restore (ID {datasetid})";
44+
}
45+
46+
public static string GetUndoDeleteDatasetMessage(long datasetid, string userName, string entityname)
47+
{
48+
string message = $"{entityname} with ID <b>{datasetid}</b> was restored";
49+
50+
if (!string.IsNullOrEmpty(userName))
51+
52+
return message += $" by <b>{userName}</b>";
53+
54+
return message + ".";
55+
}
56+
4157
public static string GetTryToDeleteDatasetHeader(long datasetid, string entityname)
4258
{
4359
return $"{entityname}: Try to delete ID {datasetid}";

Components/App/BExIS.App.Bootstrap/Attributes/BExISApiAuthorizeAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public override void OnAuthorization(HttpActionContext actionContext)
2626
using (var featurePermissionManager = new FeaturePermissionManager())
2727
using (var operationManager = new OperationManager())
2828
using (var userManager = new UserManager())
29-
using (var identityUserService = new IdentityUserService())
29+
using (var identityUserService = new IdentityUserService(userManager))
3030
{
3131
var areaName = "Api";
3232
var controllerName = actionContext.ActionDescriptor.ControllerDescriptor.ControllerName;

0 commit comments

Comments
 (0)