serenity-is / Serenity

Business Apps Made Simple with Asp.Net Core MVC / TypeScript
https://serenity.is
MIT License
2.57k stars 796 forks source link

Autherization error #7028

Closed MohamedEbrahimSaad closed 7 months ago

MohamedEbrahimSaad commented 7 months ago

Before submitting the bug report, please read and check the following items

What happened?

Description:

I am writing to report two critical issues encountered while working on a new Serenity Core project. These issues affect the creation of new users with specific permissions and a code error related to the ExtensionsTexts namespace in the project.

Issue 1: User Creation Error

When creating a new user in the Serenity Core project and assigning only one permission or some permissions to the user, the following error is encountered:

Microsoft.Data.SqlClient.SqlException (0x80131904): The multi-part identifier "jRole.RoleName" could not be bound. at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

This error seems to be tied to the scenario where a user is given only one permission or given not all permissions. The error does not occur when the user is assigned all permissions.

Issue 2: Code Error in _Sidebar.cshtml

When creating a new project, the code snippet below results in an error in the _Sidebar.cshtml file:

@ExtensionsTexts.Forms.Membership.ChangePassword.FormTitle.ToString(Localizer) The error message received is:

The name 'ExtensionsTexts' does not exist in the current context.

This suggests that there may be an issue with the namespace or context in which ExtensionsTexts is being referenced.

Steps to Reproduce:

Issue 1:

Create a new Serenity Core project. Create a new user and assign only one permission. Observe the mentioned SQL exception.

Issue 2:

Create a new Serenity Core project. Include the provided code snippet in the _Sidebar.cshtml file. Observe the error related to the ExtensionsTexts namespace. Expected Results:

Issue 1:

Users should be able to be created with any number of permissions without encountering SQL exceptions. Issue 2:

The ExtensionsTexts namespace should be recognized in the context of the _Sidebar.cshtml file without resulting in an error. image

What did you expect to happen?

Issue 1:

Create a new Serenity Core project. Create a new user and assign only one permission. Observe the mentioned SQL exception.

Issue 2:

Create a new Serenity Core project. Include the provided code snippet in the _Sidebar.cshtml file. Observe the error related to the ExtensionsTexts namespace. Expected Results:

Issue 1:

Users should be able to be created with any number of permissions without encountering SQL exceptions. Issue 2:

The ExtensionsTexts namespace should be recognized in the context of the _Sidebar.cshtml file without resulting in an error. image

How to reproduce?

Issue 1:

Create a new Serenity Core project. Create a new user and assign only one permission. Observe the mentioned SQL exception.

Issue 2:

Create a new Serenity Core project. Include the provided code snippet in the _Sidebar.cshtml file. Observe the error related to the ExtensionsTexts namespace. Expected Results:

Issue 1:

Users should be able to be created with any number of permissions without encountering SQL exceptions. Issue 2:

The ExtensionsTexts namespace should be recognized in the context of the _Sidebar.cshtml file without resulting in an error.

What Serenity Nuget Versions are you seeing the problem on? (separated by comma)

last version

Relevant log output

Microsoft.Data.SqlClient.SqlException (0x80131904): The multi-part identifier "jRole.RoleName" could not be bound. 
at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

Serene template version

.net core 6

Sergen version

No response

Code editor

No response

Operating System

No response

Node.js version

No response

TypeScript version

No response

Database type and version

No response

On which device do you see the problem?

No response

On which operating system do you see the problem?

No response

On which browsers do you see the problem?

No response

On what version of the browsers do you see the problem?

No response

Additional information

please let me know when fix it

MohamedEbrahimSaad commented 7 months ago

image

VictorTomaili commented 7 months ago

The issue related "The multi-part identifier "jRole.RoleName" could not be bound." is fixed. There is no issue about "ExtensionsTexts" found. You may need to restore your npm package and check the version of the npm packages.

nahidulislam-cse15 commented 4 months ago

how to solve this problem ? @VictorTomaili