Closed jere0500 closed 2 months ago
@geekingfrog @StanczakDominik @L-e-x-o-n Are any of you guys getting this issue? It works fine for me. Jere is unable to save any roles.
Using the root account everything works. If I then give admin role to another account (A) and use that account to modify another account, I don't see the update right away. I need to click on "recache user" for the effect to be persisted. If you then go into show > details, you see the correct roles:
I think, if anything, we should fix the stale cache issue, but things seems to work fine here.
Thanks for the feedback!
I recreated the setup and think that I had missed the mix.ecto create
command.
It works now:
I used for recreation:
I could not confirm the same stale cache issue of @geekingfrog. However, I noticed a different one: When I give another user admin privileges, and login in into that account I can not view or edit other profiles, only if the root account did edit>save changes
on that user before. Just recaching does not work. The changes I make with the new admin account are applied directly (no need to recache).
This problem does not exist when the user gets server privileges instead of admin ones.
I tested that with users created by mix teiserver.fakedata
.
Unfortunately this issue still persisted for me, maybe it is due to the elixir version (I used 1.14.5) or some dependency behaving differently. (I logged in as root@localhost so that shouldn't be an issue) Thats why I decided to dig into it more.
In a nutshell: 3 files are relevant here:
The Problem
I add IO.inspect() calls to the functions and found out that the attrs that are passed to (2.) from the form (1.) are in another format:
We can see that each checkbox is passed as their own attribute. However, the form in (1.) loads loads all the checkbox values from the roles field.
e.g.
The fields e.g. ("Bot", "Admin") are not part of the user:
Possible solution
I made a draft that transforms the attributes and fits them into the roles field, which works and fixes the issue for my setup. (I will link it soon).
However, I am kind of confused why this is not a problem for @jauggy . Maybe there are differences in the versions used.
I used Elixir 1.14.5 and Erlang/OTP 26 [erts-14.2.3] all dependency versions should be the standard ones from the mix.exs file.
Originally posted by @jere0500 in https://github.com/beyond-all-reason/teiserver/issues/272#issuecomment-2131232021