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

CreateDashboardDefaults may fail to migrate if sudo mode enabled #186

Open
HighwayStar opened this issue Oct 23, 2024 · 4 comments
Open

Comments

@HighwayStar
Copy link

When redmine configured to use sudo:
sudo_mode: true
in config/configuration.yml

CreateDashboardDefaults migration may fail if admin user has admin attribute set to false by sudo timeout.

producing log like this

== 4 CreateDashboardRoles: migrated (0.0015s) =================================

== 5 CreateDashboardDefaults: migrating =======================================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method `id' for nil:NilClass
/home/tomin/devel/redmine-test/redmine-5.0.5/plugins/additionals/db/migrate/005_create_dashboard_defaults.rb:5:in `up'
/home/tomin/devel/redmine-test/redmine-5.0.5/bundler/ruby/3.0.0/gems/activerecord-6.1.7.2/lib/active_record/migration.rb:870:in `public_send'
/home/tomin/devel/redmine-test/redmine-5.0.5/bundler/ruby/3.0.0/gems/activerecord-6.1.7.2/lib/active_record/migration.rb:870:in `exec_migration'
....

If I login to redmine as Admin user and use sudo button before trying to migrate it will create dashboard successfully and complete other migrations.

@HighwayStar
Copy link
Author

Faced this on additionals 3.0.9 and redmine 5.0.5 but other versions should be affected too.

@HighwayStar
Copy link
Author

Steps to reproduce:

  1. Install clean redmine
  2. Enable sudo mode
  3. Try to login
  4. Wait sudo cooldown time
  5. Check in console Admin user changed flag admin: true to admin: false
  6. try to add additional plugin and migrate it

@alexandermeindl
Copy link
Collaborator

Hi @HighwayStar,

I cannot reproduce the error. Do you use any other plugins? (please list it)
It should be always one admin user available in Redmine DB - independent if sudo_mod is active or not active. If no admin user is in your database, you get this error. Can you check your users table in database, if there is an existing admin user in it?

@HighwayStar
Copy link
Author

Actually seems I've used invalid steps. I've tried to migrate additionals to version 0 and back to current, but redmine_sudo depends on additionals and seems needed to migrate to version 0 in this case too.

I've tried it with many plugins installed to check some conflicts with additionals, but verified with only redmine_sudo and additionals .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants