Changes as per PR comments from Scott Brady

This commit is contained in:
Emma Garland
2021-03-12 15:05:50 +00:00
parent 8ed67aa14a
commit 9e867eeeef
3 changed files with 5 additions and 34 deletions

View File

@@ -69,13 +69,13 @@ namespace Umbraco.Cms.Core.Security
try
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
if (role == null)
{
throw new ArgumentNullException(nameof(role));
}
ThrowIfDisposed();
if (!int.TryParse(role.Id, out int roleId))
{
return Task.FromResult(IdentityResult.Failed(_intParseError));
@@ -205,36 +205,10 @@ namespace Umbraco.Cms.Core.Security
}
/// <inheritdoc />
public Task<string> GetNormalizedRoleNameAsync(TRole role, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
if (role == null)
{
throw new ArgumentNullException(nameof(role));
}
//TODO: are we utilising NormalizedRoleName?
return Task.FromResult(role.NormalizedName);
}
public Task<string> GetNormalizedRoleNameAsync(TRole role, CancellationToken cancellationToken = default) => GetRoleNameAsync(role, cancellationToken);
/// <inheritdoc />
public Task SetNormalizedRoleNameAsync(TRole role, string normalizedName, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
if (role == null)
{
throw new ArgumentNullException(nameof(role));
}
//TODO: are we utilising NormalizedRoleName and do we need to set it in the memberGroupService?
role.NormalizedName = normalizedName;
return Task.CompletedTask;
}
public Task SetNormalizedRoleNameAsync(TRole role, string normalizedName, CancellationToken cancellationToken = default) => SetRoleNameAsync(role, normalizedName, cancellationToken);
/// <inheritdoc />
public Task<TRole> FindByIdAsync(string roleId, CancellationToken cancellationToken = default)
@@ -280,8 +254,6 @@ namespace Umbraco.Cms.Core.Security
throw new ArgumentNullException(nameof(name));
}
IMemberGroup memberGroup = _memberGroupService.GetByName(name);
//TODO: throw exception when not found?
return Task.FromResult(memberGroup == null ? null : MapFromMemberGroup(memberGroup));
}

View File

@@ -2435,7 +2435,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
.Select(_umbracoMapper.Map<MemberDisplay>)
.ToArray();
//TODO: change to role store
//TODO: change to role manager
var allGroups = _memberGroupService.GetAll().ToArray();
var groups = entry.Rules
.Where(rule => rule.RuleType == Constants.Conventions.PublicAccess.MemberRoleRuleType)

View File

@@ -24,7 +24,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.Identity.Core" Version="2.2.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.3" />