I suspect that this happens because there are no app roles (user app permissions) created for the new user, not even the one for the dashboard. The function to create a user via the CLI is completely separate from the regular API one, don't ask me why.
I see that the CLI version also doesn't send an initial recovery/welcome email. I'd change that as well so it does that, do you agree?
I see that the CLI version also doesn't send an initial recovery/welcome email. I'd change that as well so it does that, do you agree?
Well in the end it was easier to skip that and only fix the dashboard role, which fixes your immediate issue. I have another issue for later to refactor this old code so the cli and api version share relevant code.
Added a new user a while ago and added a new app now, she is able to log in to Zulip & Nextcloud but having issues with my custom apps. Thought I could adjust via CLI but getting this curious error:
❯ stack user show MAILRunning exec on stackspin dashboard-backend-7f68cbf596-f85xd[2025-01-20 10:41:27,689] INFO in root (app.py+171): WERKZEUG_RUN_MAIN: unset[2025-01-20 10:41:27,689] INFO in root (app.py+176): Not running initialization code (dev or cli mode).[2025-01-20 10:41:27,690] INFO in root (app.py+185): Disposing of database connections."NAME" <MAIL>UUID: fd5e6f56-XXXUsername: NAMEUpdated: 2024-10-29 17:57:03+00:00Created: 2024-10-29 17:57:03+00:00State: activeRoles:Traceback (most recent call last): File "/usr/local/bin/flask", line 8, in <module> sys.exit(main()) ~~~~^^ File "/usr/local/lib/python3.13/site-packages/flask/cli.py", line 1129, in main cli.main() ~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.13/site-packages/click/core.py", line 1688, in invokereturn _process_result(sub_ctx.command.invoke(sub_ctx)) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/click/core.py", line 1688, in invokereturn _process_result(sub_ctx.command.invoke(sub_ctx)) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/click/core.py", line 1688, in invokereturn _process_result(sub_ctx.command.invoke(sub_ctx)) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/click/core.py", line 1434, in invokereturn ctx.invoke(self.callback, **ctx.params) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/click/core.py", line 783, in invokereturn __callback(*args, **kwargs) File "/usr/local/lib/python3.13/site-packages/click/decorators.py", line 33, in new_funcreturn f(get_current_context(), *args, **kwargs) File "/usr/local/lib/python3.13/site-packages/flask/cli.py", line 400, in decoratorreturn ctx.invoke(f, *args, **kwargs) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/click/core.py", line 783, in invokereturn __callback(*args, **kwargs) File "/app/cliapp/cliapp/cli.py", line 285, in show_user results = db.session.query(AppRole, Role).join(App, Role)\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "<string>", line 2, in joinFile "/usr/local/lib/python3.13/site-packages/sqlalchemy/sql/base.py", line 279, in _generative x = fn(self, *args, **kw) File "<string>", line 2, in joinFile "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/base.py", line 306, in generate fn(self, *args, **kw) ~~^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/query.py", line 2429, in joinonclause_element = coercions.expect( roles.OnClauseRole, onclause, legacy=True) File "/usr/local/lib/python3.13/site-packages/sqlalchemy/sql/coercions.py", line 395, in expect resolved = impl._literal_coercion( element, argname=argname, **kw) File "/usr/local/lib/python3.13/site-packages/sqlalchemy/sql/coercions.py", line 909, in _literal_coercion self._raise_for_expected(element) ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/sql/coercions.py", line 518, in _raise_for_expected raise exc.ArgumentError(msg, code=code) from errsqlalchemy.exc.ArgumentError: ON clause, typically a SQL expression or ORM relationship attribute expected, got <class 'areas.roles.models.Role'>.command terminated with exit code 1
sqlalchemy.exc.ArgumentError: ON clause, typically a SQL expression or ORM relationship attribute expected, got <class 'areas.roles.models.Role'>.command terminated with exit code 1
Ah, seems sqlalchemy evolved at some point and we have to adapt our query in show_user, sorry about that! I'll fix it right away.
Note that this has nothing to do with custom apps or logging in, I get the same error on my plain test instance.