LDAP admin updata bug #11643

Closed
opened 2025-11-02 09:43:18 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @CaiCandong on GitHub (Sep 13, 2023).

Description

When you have set administrator privileges for a user through LDAP settings, and after some time, you cancel the administrator privileges for that user in LDAP. You will find that the administrator privileges cannot be canceled.

The problem comes from the LDAP settings, if the Gitea instance does not specify a username query rule, for user_model.IsUserExist(db.DefaultContext, 0, sr.Username), sr.Username is an empty string "", isExist always be false, so can't update the user.

image

a55ff0dd99/services/auth/source/ldap/source_authenticate.go (L27-L36)

Gitea Version

a55ff0dd99

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

source code

Database

None

Originally created by @CaiCandong on GitHub (Sep 13, 2023). ### Description When you have set administrator privileges for a user through LDAP settings, and after some time, you cancel the administrator privileges for that user in LDAP. You will find that the administrator privileges cannot be canceled. The problem comes from the LDAP settings, if the Gitea instance does not specify a username query rule, for `user_model.IsUserExist(db.DefaultContext, 0, sr.Username)`, `sr.Username` is an empty string `""`, `isExist` always be `false`, so can't update the user. ![image](https://github.com/go-gitea/gitea/assets/50507092/403f5a7e-4346-4ccf-ba75-417f66f26d38) https://github.com/go-gitea/gitea/blob/a55ff0dd99439eb96151e64be38e0f14f6e723b7/services/auth/source/ldap/source_authenticate.go#L27-L36 ### Gitea Version a55ff0dd99439eb96151e64be38e0f14f6e723b7 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? source code ### Database None
GiteaMirror added the topic/authenticationtype/bug labels 2025-11-02 09:43:18 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11643