question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When multiple users set the same email, editing role information will be wrong

See original GitHub issue

Describe the bug

When multiple users set the same email, editing role information will throw an exception.

To Reproduce

When multiple users set the same email image

Add role to one of the users image

image

image

This situation seems to be caused by the use of email information to query users within the framework


After thinking about it, we found that in the admin panel, we can’t set up two roles of the same email, but in the STS.Identity In, we can change our email information to an existing email

Relevant parts of the log file

System.InvalidOperationException: Sequence contains more than one element at System.Linq.ThrowHelper.ThrowMoreThanOneElementException() at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression) at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable1 source) at Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore9.FindByEmailAsync(String normalizedEmail, CancellationToken cancellationToken) at Microsoft.AspNetCore.Identity.UserManager1.FindByEmailAsync(String email) at Microsoft.AspNetCore.Identity.UserValidator1.ValidateEmail(UserManager1 manager, TUser user, List1 errors) at Microsoft.AspNetCore.Identity.UserValidator1.ValidateAsync(UserManager1 manager, TUser user) at Microsoft.AspNetCore.Identity.UserManager1.ValidateUserAsync(TUser user) at Microsoft.AspNetCore.Identity.UserManager1.UpdateUserAsync(TUser user) at Microsoft.AspNetCore.Identity.UserManager1.AddToRoleAsync(TUser user, String role) at Skoruba.IdentityServer4.Admin.EntityFramework.Identity.Repositories.IdentityRepository11.CreateUserRoleAsync(String userId, String roleId) at Skoruba.IdentityServer4.Admin.BusinessLogic.Identity.Services.IdentityService22.CreateUserRoleAsync(TUserRolesDto role) at CPDIS.IdentityServer.Admin.Controllers.IdentityController22.UserRoles(TUserRolesDto role) in E:\DevWork\OutSource\CPDIS\CPDIS.IdentityServer\src\CPDIS.IdentityServer.Admin\Controllers\IdentityController.cs:line 195 at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() — End of stack trace from previous location where exception was thrown — at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter() — End of stack trace from previous location where exception was thrown — at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() — End of stack trace from previous location where exception was thrown — at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.CspMiddleware.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yomunsamcommented, Jun 24, 2020

image

Use username.

And I modified the settings of StartupHelpers, will it be related to this?

image

0reactions
skorubacommented, Jul 10, 2020

@vicentt - thanks for you feedback regarding this issue - I will go through all app and test it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

There are multiple recipients matching the identity error
Cause. This problem occurs if multiple mailboxes or mail contacts have the same display name. Exchange examines the Display name field or the ......
Read more >
Add, edit, and delete users and user groups - Analytics Help
Manage the list of users who have access to your Analytics account.Deleting users and user groups does not delete personally identifiable information (PII)....
Read more >
Email Security Cloud Gateway - Managing User ...
This guide describes how user email addresses can be manually or automatically managed to control access to your Mimecast account.
Read more >
Is it bad practice to store a user's email address in a JWT?
Yes, it is bad practice and a security problem. Email addresses are PII (personally identifiable information). Like all other PII, ...
Read more >
“Disable Multiple User Roles” setting bug with roles when ...
Okay, I think I have a potential fix for this bug. In features/roles-editor/roles-editor.php around line 1208 , change: function roles_update_user_new_and_edit( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found