mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 15:01:56 +00:00
Fixed location update does not cause update of assets and users, fixed ldap async issue
This commit is contained in:
@@ -69,6 +69,8 @@ public class LocationsController : Controller
|
||||
}
|
||||
try
|
||||
{
|
||||
LocationModel location = await _ldap.GetLocationByCnAsync(cn);
|
||||
await SynchronizationHelper.SyncLocationName(_ldap, location.Location, "");
|
||||
await _ldap.DeleteLocationAsync(cn);
|
||||
return new(true);
|
||||
}
|
||||
@@ -92,7 +94,7 @@ public class LocationsController : Controller
|
||||
string location = requestModel.Location;
|
||||
LocationsDescription room = requestModel.Description;
|
||||
string newLocation = StringHelpers.Slugify(room.Location + " " + room.RoomNumber + " " + room.Seat); // TODO: fix DRY violation
|
||||
|
||||
await SynchronizationHelper.SyncLocationName(_ldap, location, newLocation);
|
||||
await _ldap.UpdateLocation(location, "description", JsonSerializer.Serialize(room));
|
||||
await _ldap.UpdateLocation(location, "l", newLocation);
|
||||
return new LocationsUpdateResponseModel { Success = true };
|
||||
|
||||
@@ -51,9 +51,8 @@ public class UsersController : Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
var syncAssetOwnership = SynchronizationHelper.SyncAssetOwnership(_ldap, uid, "");
|
||||
await SynchronizationHelper.SyncAssetOwnership(_ldap, uid, "");
|
||||
await _ldap.DeleteUserAsync(uid);
|
||||
await syncAssetOwnership;
|
||||
return new UsersDeleteRequestModel(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -124,10 +123,9 @@ public class UsersController : Controller
|
||||
UserModel? user = null;
|
||||
if (requestModel.NewUid is not null && requestModel.NewUid.Length > 0)
|
||||
{
|
||||
var syncAssetOwnership = SynchronizationHelper.SyncAssetOwnership(_ldap, uid, requestModel.NewUid);
|
||||
await SynchronizationHelper.SyncAssetOwnership(_ldap, uid, requestModel.NewUid);
|
||||
await _ldap.UpdateUser(uid, "uid", requestModel.NewUid);
|
||||
uid = requestModel.NewUid;
|
||||
await syncAssetOwnership;
|
||||
}
|
||||
if (requestModel.Title is not null)
|
||||
{
|
||||
@@ -170,10 +168,9 @@ public class UsersController : Controller
|
||||
}
|
||||
if (newUid != uid)
|
||||
{
|
||||
var syncAssetOwnership = SynchronizationHelper.SyncAssetOwnership(_ldap, uid, newUid);
|
||||
await SynchronizationHelper.SyncAssetOwnership(_ldap, uid, newUid);
|
||||
await _ldap.UpdateUser(uid, "uid", newUid);
|
||||
uid = newUid;
|
||||
await syncAssetOwnership;
|
||||
}
|
||||
return new() { Success = true, NewUid = uid };
|
||||
} catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user