V14: Consistently refer to user key (#14685)
* Fixup UserService * Fixup PartialViewService * Fixup ScriptService * Fixup StylesheetService * Use keys with usergroups instead of IDs * Fix missed instances of performingUser * Fixup DataTypeFolderControllerBase --------- Co-authored-by: kjac <kja@umbraco.dk>
This commit is contained in:
@@ -599,12 +599,12 @@ internal class UserService : RepositoryService, IUserService
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<Attempt<UserCreationResult, UserOperationStatus>> CreateAsync(Guid performingUserKey, UserCreateModel model, bool approveUser = false)
|
||||
public async Task<Attempt<UserCreationResult, UserOperationStatus>> CreateAsync(Guid userKey, UserCreateModel model, bool approveUser = false)
|
||||
{
|
||||
using ICoreScope scope = ScopeProvider.CreateCoreScope();
|
||||
using IServiceScope serviceScope = _serviceScopeFactory.CreateScope();
|
||||
|
||||
IUser? performingUser = await GetAsync(performingUserKey);
|
||||
IUser? performingUser = await GetAsync(userKey);
|
||||
|
||||
if (performingUser is null)
|
||||
{
|
||||
@@ -680,12 +680,12 @@ internal class UserService : RepositoryService, IUserService
|
||||
return Attempt.SucceedWithStatus(UserOperationStatus.Success, creationResult);
|
||||
}
|
||||
|
||||
public async Task<Attempt<UserInvitationResult, UserOperationStatus>> InviteAsync(Guid performingUserKey, UserInviteModel model)
|
||||
public async Task<Attempt<UserInvitationResult, UserOperationStatus>> InviteAsync(Guid userKey, UserInviteModel model)
|
||||
{
|
||||
using ICoreScope scope = ScopeProvider.CreateCoreScope();
|
||||
using IServiceScope serviceScope = _serviceScopeFactory.CreateScope();
|
||||
|
||||
IUser? performingUser = await GetAsync(performingUserKey);
|
||||
IUser? performingUser = await GetAsync(userKey);
|
||||
|
||||
if (performingUser is null)
|
||||
{
|
||||
@@ -803,7 +803,7 @@ internal class UserService : RepositoryService, IUserService
|
||||
return UserOperationStatus.Success;
|
||||
}
|
||||
|
||||
public async Task<Attempt<IUser?, UserOperationStatus>> UpdateAsync(Guid performingUserKey, UserUpdateModel model)
|
||||
public async Task<Attempt<IUser?, UserOperationStatus>> UpdateAsync(Guid userKey, UserUpdateModel model)
|
||||
{
|
||||
using ICoreScope scope = ScopeProvider.CreateCoreScope();
|
||||
using IServiceScope serviceScope = _serviceScopeFactory.CreateScope();
|
||||
@@ -816,7 +816,7 @@ internal class UserService : RepositoryService, IUserService
|
||||
return Attempt.FailWithStatus(UserOperationStatus.MissingUser, existingUser);
|
||||
}
|
||||
|
||||
IUser? performingUser = await userStore.GetAsync(performingUserKey);
|
||||
IUser? performingUser = await userStore.GetAsync(userKey);
|
||||
|
||||
if (performingUser is null)
|
||||
{
|
||||
@@ -1007,7 +1007,7 @@ internal class UserService : RepositoryService, IUserService
|
||||
return keys;
|
||||
}
|
||||
|
||||
public async Task<Attempt<PasswordChangedModel, UserOperationStatus>> ChangePasswordAsync(Guid performingUserKey, ChangeUserPasswordModel model)
|
||||
public async Task<Attempt<PasswordChangedModel, UserOperationStatus>> ChangePasswordAsync(Guid userKey, ChangeUserPasswordModel model)
|
||||
{
|
||||
IServiceScope serviceScope = _serviceScopeFactory.CreateScope();
|
||||
using ICoreScope scope = ScopeProvider.CreateCoreScope();
|
||||
@@ -1019,7 +1019,7 @@ internal class UserService : RepositoryService, IUserService
|
||||
return Attempt.FailWithStatus(UserOperationStatus.UserNotFound, new PasswordChangedModel());
|
||||
}
|
||||
|
||||
IUser? performingUser = await userStore.GetAsync(performingUserKey);
|
||||
IUser? performingUser = await userStore.GetAsync(userKey);
|
||||
if (performingUser is null)
|
||||
{
|
||||
return Attempt.FailWithStatus(UserOperationStatus.MissingUser, new PasswordChangedModel());
|
||||
@@ -1052,11 +1052,11 @@ internal class UserService : RepositoryService, IUserService
|
||||
return Attempt.SucceedWithStatus(UserOperationStatus.Success, result.Result ?? new PasswordChangedModel());
|
||||
}
|
||||
|
||||
public async Task<Attempt<PagedModel<IUser>?, UserOperationStatus>> GetAllAsync(Guid requestingUserKey, int skip, int take)
|
||||
public async Task<Attempt<PagedModel<IUser>?, UserOperationStatus>> GetAllAsync(Guid userKey, int skip, int take)
|
||||
{
|
||||
using ICoreScope scope = ScopeProvider.CreateCoreScope();
|
||||
|
||||
IUser? requestingUser = await GetAsync(requestingUserKey);
|
||||
IUser? requestingUser = await GetAsync(userKey);
|
||||
|
||||
if (requestingUser is null)
|
||||
{
|
||||
@@ -1099,7 +1099,7 @@ internal class UserService : RepositoryService, IUserService
|
||||
}
|
||||
|
||||
public async Task<Attempt<PagedModel<IUser>, UserOperationStatus>> FilterAsync(
|
||||
Guid requestingUserKey,
|
||||
Guid userKey,
|
||||
UserFilter filter,
|
||||
int skip = 0,
|
||||
int take = 100,
|
||||
@@ -1108,7 +1108,7 @@ internal class UserService : RepositoryService, IUserService
|
||||
{
|
||||
using ICoreScope scope = ScopeProvider.CreateCoreScope();
|
||||
|
||||
IUser? requestingUser = await GetAsync(requestingUserKey);
|
||||
IUser? requestingUser = await GetAsync(userKey);
|
||||
|
||||
if (requestingUser is null)
|
||||
{
|
||||
@@ -1292,7 +1292,7 @@ internal class UserService : RepositoryService, IUserService
|
||||
return UserOperationStatus.Success;
|
||||
}
|
||||
|
||||
public async Task<UserOperationStatus> DisableAsync(Guid performingUserKey, ISet<Guid> keys)
|
||||
public async Task<UserOperationStatus> DisableAsync(Guid userKey, ISet<Guid> keys)
|
||||
{
|
||||
if(keys.Any() is false)
|
||||
{
|
||||
@@ -1300,7 +1300,7 @@ internal class UserService : RepositoryService, IUserService
|
||||
}
|
||||
|
||||
using ICoreScope scope = ScopeProvider.CreateCoreScope();
|
||||
IUser? performingUser = await GetAsync(performingUserKey);
|
||||
IUser? performingUser = await GetAsync(userKey);
|
||||
|
||||
if (performingUser is null)
|
||||
{
|
||||
@@ -1338,7 +1338,7 @@ internal class UserService : RepositoryService, IUserService
|
||||
return UserOperationStatus.Success;
|
||||
}
|
||||
|
||||
public async Task<UserOperationStatus> EnableAsync(Guid performingUserKey, ISet<Guid> keys)
|
||||
public async Task<UserOperationStatus> EnableAsync(Guid userKey, ISet<Guid> keys)
|
||||
{
|
||||
if(keys.Any() is false)
|
||||
{
|
||||
@@ -1346,7 +1346,7 @@ internal class UserService : RepositoryService, IUserService
|
||||
}
|
||||
|
||||
using ICoreScope scope = ScopeProvider.CreateCoreScope();
|
||||
IUser? performingUser = await GetAsync(performingUserKey);
|
||||
IUser? performingUser = await GetAsync(userKey);
|
||||
|
||||
if (performingUser is null)
|
||||
{
|
||||
@@ -1408,7 +1408,7 @@ internal class UserService : RepositoryService, IUserService
|
||||
return UserOperationStatus.Success;
|
||||
}
|
||||
|
||||
public async Task<Attempt<UserUnlockResult, UserOperationStatus>> UnlockAsync(Guid performingUserKey, params Guid[] keys)
|
||||
public async Task<Attempt<UserUnlockResult, UserOperationStatus>> UnlockAsync(Guid userKey, params Guid[] keys)
|
||||
{
|
||||
if (keys.Length == 0)
|
||||
{
|
||||
@@ -1416,7 +1416,7 @@ internal class UserService : RepositoryService, IUserService
|
||||
}
|
||||
|
||||
using ICoreScope scope = ScopeProvider.CreateCoreScope();
|
||||
IUser? performingUser = await GetAsync(performingUserKey);
|
||||
IUser? performingUser = await GetAsync(userKey);
|
||||
|
||||
if (performingUser is null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user