public Task InvokeUserDeleteAsync(Authentication authentication, UserDeleteArguments args) { var context = this.Context; var repository = this.Repository; var message = EventMessageBuilder.DeleteUser(authentication, args.UserID); return(repository.Dispatcher.InvokeAsync(() => { using var locker = new RepositoryHostLock(repository, authentication, this, nameof(InvokeUserDeleteAsync), args.LockPaths); try { var userSet = args.Read(authentication, repository); var userContextSet = new UserContextSet(context, userSet, false); repository.DeleteUser(userContextSet, args.UserPath); repository.Commit(authentication, message); } catch { repository.Revert(); throw; } })); }
public Task InvokeCategoryCreateAsync(Authentication authentication, string categoryPath) { var context = this.Context; var repository = this.Repository; var itemPaths = new string[] { categoryPath }; var message = EventMessageBuilder.CreateUserCategory(authentication, categoryPath); return(repository.Dispatcher.InvokeAsync(() => { using var locker = new RepositoryHostLock(repository, authentication, this, nameof(InvokeCategoryCreateAsync), itemPaths); try { var userContextSet = UserContextSet.CreateEmpty(authentication, context, itemPaths); repository.CreateUserCategory(categoryPath); repository.Commit(authentication, message); } catch { repository.Revert(); throw; } })); }
public Task <UserSerializationInfo> InvokeUserPasswordResetAsync(Authentication authentication, UserResetPasswordArguments args) { var context = this.Context; var repository = this.Repository; var message = EventMessageBuilder.ResetPassword(authentication, args.UserID, args.UserName); return(repository.Dispatcher.InvokeAsync(() => { using var locker = new RepositoryHostLock(repository, authentication, this, nameof(InvokeUserPasswordSetAsync), args.LockPaths); try { var userSet = args.Read(authentication, repository); var userContextSet = new UserContextSet(context, userSet, false); repository.ModifyUser(userContextSet, args.UserPath, args.Password); repository.Commit(authentication, message); return userContextSet.GetUserInfo(args.UserPath); } catch { repository.Revert(); throw; } })); }
public Task <UserSerializationInfo> InvokeUserCreateAsync(Authentication authentication, UserCreateArguments args) { var context = this.Context; var repository = this.Repository; var message = EventMessageBuilder.CreateUser(authentication, args.UserPaths, args.UserNames); return(repository.Dispatcher.InvokeAsync(() => { using var locker = new RepositoryHostLock(repository, authentication, this, nameof(InvokeUserMoveAsync), args.LockPaths); try { var userSet = args.Create(authentication); var userContextSet = new UserContextSet(context, userSet, true); repository.CreateUser(userContextSet, args.UserPaths); repository.Commit(authentication, message); return userContextSet.GetUserInfo(args.UserPath); } catch { repository.Revert(); throw; } })); }