New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update API to return 'source_id' for users #29718
Conversation
You need to generate swagger docs. |
I agree re |
Is there no way to get this into 1.22.0 @lunny? I don't know what I need to change to make @techknowlogick and @delvh approve of it? |
This looks not too big and is not a feature and got 2 approvals before the v1.22 branch was created. I think it's possible to backport to v1.22 if @techknowlogick and @delvh have no objections. |
So, did you come to a conclusion which name to use? |
I proposed this earlier: #29718 (comment) |
So, what do you think of my suggestion @delvh @techknowlogick ? |
Suddenly, I have another idea. Since we have the opportunity to refactor the user system. Maybe we should remove login_source_id in the user table but put it into external_account because one user could bind multiple auth systems. So if we merge this PR, we need to deprecate it later. |
I'm not sure we are talking about the same thing here. A user can only have a single authentication source . |
This is the current design but I think the user can also login with some OAuth2. |
I have this set up with two openID authentication sources for two different types of users. Since I can not get the auth source ID from the API, I can not (easily) tell the users apart. Is this system going to change in the next version of Gitea? |
I think it will not be in next version of Gitea but we know it has the problem and would like to do a new design like that. Maybe we can have a new API to get a user's all auth sources so it will look compatible with backend. |
Hmmm.... I'm now really confused @lunny . I think you are saying one of these things:
Thanks |
Sorry to be pushy, but what are we going to do about this PR? I think it's quite the oversight, that you can currently use the API to set the source_id for a user, but not retrieve it. @lunny @delvh @techknowlogick |
Yes, I agree. I think if we have a set, we need to have a get. And if/when a refactor happens then it'll also affect the set, so it'd already be breaking, so adding the get wouldn't affect things. |
Sounds good. Can you approve the PR please? |
* giteaofficial/main: Reduce unnecessary database queries on actions table (go-gitea#30509) [skip ci] Updated translations via Crowdin Tweak and fix toggle checkboxes (go-gitea#30527) Tweak repo buttons on mobile and labeled button border-radius (go-gitea#30503) Fix long branch name overflows (go-gitea#30345) Update API to return 'source_id' for users (go-gitea#29718) Allow `preferred_username` as username source for OIDC (go-gitea#30454) Fix empty field `login_name` in API response JSON when creating user (go-gitea#30511) feat(api): implement branch/commit comparison API (go-gitea#30349)
Using the API, a user's source_id can be set in the CreateUserOption model, but the field is not returned in the User model.
This PR updates the User model to include the field source_id (The ID of the Authentication Source).
The name source_id is a bit confusing since it does not hint at any relation with the login_name field. Perhaps login_source_id or login_id would be a better name? If a different name than source_id was to be used, the name should also be updated in the CreateUserOption and EditUserOptions models.