Revert files that shouldn't change back in v11

This commit is contained in:
Sebastiaan Janssen
2022-09-19 16:37:24 +02:00
parent 85147fb5e8
commit db5d05d641
201 changed files with 933 additions and 1859 deletions

View File

@@ -81,47 +81,15 @@ public class CurrentUserController : UmbracoAuthorizedJsonController
_userDataService = userDataService;
}
[Obsolete("This constructor is obsolete and will be removed in v11, use constructor with all values")]
public CurrentUserController(
MediaFileManager mediaFileManager,
IOptions<ContentSettings> contentSettings,
IHostingEnvironment hostingEnvironment,
IImageUrlGenerator imageUrlGenerator,
IBackOfficeSecurityAccessor backofficeSecurityAccessor,
IUserService userService,
IUmbracoMapper umbracoMapper,
IBackOfficeUserManager backOfficeUserManager,
ILoggerFactory loggerFactory,
ILocalizedTextService localizedTextService,
AppCaches appCaches,
IShortStringHelper shortStringHelper,
IPasswordChanger<BackOfficeIdentityUser> passwordChanger) : this(
mediaFileManager,
StaticServiceProvider.Instance.GetRequiredService<IOptionsSnapshot<ContentSettings>>(),
hostingEnvironment,
imageUrlGenerator,
backofficeSecurityAccessor,
userService,
umbracoMapper,
backOfficeUserManager,
localizedTextService,
appCaches,
shortStringHelper,
passwordChanger,
StaticServiceProvider.Instance.GetRequiredService<IUserDataService>())
{
}
/// <summary>
/// Returns permissions for all nodes passed in for the current user
/// </summary>
/// <param name="nodeIds"></param>
/// <returns></returns>
[HttpPost]
public Dictionary<int, string[]> GetPermissions(int[] nodeIds)
{
EntityPermissionCollection permissions = _userService
/// <summary>
/// Returns permissions for all nodes passed in for the current user
/// </summary>
/// <param name="nodeIds"></param>
/// <returns></returns>
[HttpPost]
public Dictionary<int, string[]> GetPermissions(int[] nodeIds)
{
EntityPermissionCollection permissions = _userService
.GetPermissions(_backofficeSecurityAccessor.BackOfficeSecurity?.CurrentUser, nodeIds);
var permissionsDictionary = new Dictionary<int, string[]>();
@@ -230,12 +198,13 @@ public class CurrentUserController : UmbracoAuthorizedJsonController
[AllowAnonymous]
public async Task<ActionResult<UserDetail?>> PostSetInvitedUserPassword([FromBody] string newPassword)
{
BackOfficeIdentityUser? user = await _backOfficeUserManager.FindByIdAsync(_backofficeSecurityAccessor
.BackOfficeSecurity?.GetUserId().ResultOr(0).ToString());
if (user == null)
var userId = _backofficeSecurityAccessor.BackOfficeSecurity?.GetUserId().ResultOr(0).ToString();
if (userId is null)
{
throw new InvalidOperationException("Could not find user");
throw new InvalidOperationException("Could not find user Id");
}
var user = await _backOfficeUserManager.FindByIdAsync(userId);
if (user == null) throw new InvalidOperationException("Could not find user");
IdentityResult result = await _backOfficeUserManager.AddPasswordAsync(user, newPassword);
@@ -335,8 +304,18 @@ public class CurrentUserController : UmbracoAuthorizedJsonController
[ValidateAngularAntiForgeryToken]
public async Task<Dictionary<string, string>> GetCurrentUserLinkedLogins()
{
BackOfficeIdentityUser identityUser = await _backOfficeUserManager.FindByIdAsync(_backofficeSecurityAccessor
.BackOfficeSecurity?.GetUserId().ResultOr(0).ToString(CultureInfo.InvariantCulture));
var userId = _backofficeSecurityAccessor.BackOfficeSecurity?.GetUserId().ResultOr(0).ToString(CultureInfo.InvariantCulture);
if (userId is null)
{
throw new InvalidOperationException("Could not find user Id");
}
BackOfficeIdentityUser? identityUser = await _backOfficeUserManager.FindByIdAsync(userId);
if (identityUser is null)
{
throw new InvalidOperationException("Could not find user");
}
// deduplicate in case there are duplicates (there shouldn't be now since we have a unique constraint on the external logins
// but there didn't used to be)