Skip to content
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

Org name doesn't change after User is renamed #3342

Closed
3 tasks done
zc-devs opened this issue Feb 7, 2024 · 7 comments · Fixed by #3409
Closed
3 tasks done

Org name doesn't change after User is renamed #3342

zc-devs opened this issue Feb 7, 2024 · 7 comments · Fixed by #3409
Labels
bug Something isn't working
Milestone

Comments

@zc-devs
Copy link
Contributor

zc-devs commented Feb 7, 2024

Component

server

Describe the bug

Local Gitea usr2 exists

woodpecker_test=# select user_id, user_login, user_org_id from users order by user_id;
 user_id | user_login | user_org_id
---------+------------+-------------
       3 | usr2       |           3
(5 rows)

woodpecker_test=# select * from orgs;
 id | name | is_user | private
----+------+---------+---------
  3 | usr2 | t       | f
(5 rows)

Go to Gitea Site Administration -> Identity and Access -> User Accounts. Edit usr2. Change Username to usr2-gitea-local.
Relogin in Gitea and Woodpecker by usr2-gitea-local.

woodpecker_test=# select user_id, user_login, user_org_id from users order by user_id;
 user_id |    user_login    | user_org_id
---------+------------------+-------------
       3 | usr2-gitea-local |           3
(5 rows)

woodpecker_test=# select * from orgs;
 id | name | is_user | private
----+------+---------+---------
  3 | usr2 | t       | f

User login was changed, but not organization name.
Now, if we go to User's profile page in Woodpecker we get

An unknown error occurred
GET
https://woodpecker.test.smthd.com/api/orgs/3/secrets?page=1
[HTTP/2 403  61ms]

System Info

Woodpecker 2.3.0, Gitea 1.21.5, Postgres 16

Additional context

No response

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Checked that the bug isn't fixed in the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
@zc-devs zc-devs added the bug Something isn't working label Feb 7, 2024
@zc-devs zc-devs changed the title Org name doesn't changes after User is renamed Org name doesn't change after User is renamed Feb 7, 2024
@qwerty287 qwerty287 added this to the 2.x.x milestone Feb 7, 2024
@zc-devs
Copy link
Contributor Author

zc-devs commented Feb 18, 2024

#3328 (comment)

users.user_login=MrMeeb
orgs.name=mrmeeb

@MrMeeb, try to rename user to mrmeeb or organization to MrMeeb and test again.

@qwerty287 qwerty287 modified the milestones: 2.x.x, 2.4.0 Feb 18, 2024
@MrMeeb
Copy link

MrMeeb commented Feb 18, 2024

Updated orgs.name to MrMeeb and now it seems to work. Want to be clear that I did not rename my user to cause this though, this was the out of the box behaviour. All I did was sign in to Woodpecker and try to create secrets.

@pat-s
Copy link
Contributor

pat-s commented Feb 19, 2024

Hmm, looks like we do have a sanitization issue? Maybe this is also the solution for the cases in https://codeberg.org/Codeberg-CI/feedback/issues/149 where actually there is a valid, unique user org but the username is capitalized while in the org table it is all lowercase.

@pat-s
Copy link
Contributor

pat-s commented Feb 19, 2024

Uff, we really have a case-sensitive DB issue: https://codeberg.org/Codeberg-CI/feedback/issues/149#issuecomment-1572908

@zc-devs
Copy link
Contributor Author

zc-devs commented Feb 19, 2024

case-sensitive DB issue

Should separate issue be opened?

@MrMeeb
Copy link

MrMeeb commented Feb 19, 2024

I'll add that when going to User > Secrets, the workaround resolves this. When going into a repo > secrets, I'm seeing a similar issue: accessing https://ci.domain.com/api/secrets?page=1 gets 403. Weirdly when going to the secrets tab of the repo I can see my organisation secrets, and create secrets in the repo. But I still get that 403 error

@qwerty287
Copy link
Contributor

accessing https://ci.domain.com/api/secrets?page=1 gets 403

That's a different issue with permissions since we show all secrets in ui (also globals) but if you are not an admin you can't access the global secrets. See #3013

qwerty287 added a commit that referenced this issue Feb 21, 2024
and create a new org once a user is created (logged in for the first
time)

closes #3342

---------

Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants