diff --git a/csharp/App/Backend/DataTypes/Methods/Session.cs b/csharp/App/Backend/DataTypes/Methods/Session.cs index fd2e7da08..58aed8b81 100644 --- a/csharp/App/Backend/DataTypes/Methods/Session.cs +++ b/csharp/App/Backend/DataTypes/Methods/Session.cs @@ -376,8 +376,7 @@ public static class SessionMethods && sessionUser.HasAccessTo(originalUser) && editedUser .WithParentOf(originalUser) // prevent moving - .WithNameOf(originalUser) - .WithPasswordOf(originalUser) + .WithPasswordOf(originalUser) .Apply(Db.Update); } @@ -473,24 +472,24 @@ public static class SessionMethods public static Boolean RevokeUserAccessTo(this Session? session, User? user, Installation? installation) { var sessionUser = session?.User; - + return sessionUser is not null && installation is not null && user is not null - && user.IsDescendantOf(sessionUser) + && (user.IsDescendantOf(sessionUser) || sessionUser.UserType == 2) && sessionUser.HasAccessTo(installation) && user.HasAccessTo(installation) && Db.InstallationAccess.Delete(a => a.UserId == user.Id && a.InstallationId == installation.Id) > 0; } - + public static Boolean RevokeUserAccessTo(this Session? session, User? user, Folder? folder) { var sessionUser = session?.User; - + return sessionUser is not null && folder is not null && user is not null - && user.IsDescendantOf(sessionUser) + && (user.IsDescendantOf(sessionUser) || sessionUser.UserType == 2) && sessionUser.HasAccessTo(folder) && user.HasAccessTo(folder) && Db.FolderAccess.Delete(a => a.UserId == user.Id && a.FolderId == folder.Id) > 0; diff --git a/csharp/App/Backend/Database/Update.cs b/csharp/App/Backend/Database/Update.cs index 88e748240..50037b701 100644 --- a/csharp/App/Backend/Database/Update.cs +++ b/csharp/App/Backend/Database/Update.cs @@ -40,10 +40,9 @@ public static partial class Db var originalUser = GetUserById(user.Id); if (originalUser is null) return false; - // these columns must not be modified! - user.ParentId = originalUser.ParentId; - user.Name = originalUser.Name; - + // ParentId must not be modified via this method + user.ParentId = originalUser.ParentId; + return Update(obj: user); }