noshutdown-ru / vault

Is a plugin for project management system Redmine. Allows you to store various passwords/keys in one place for the project.
https://noshutdown.ru/en/redmine-plugins-vault
46 stars 29 forks source link

Redmine 5.0 #91

Open lluisgener opened 2 years ago

lluisgener commented 2 years ago

Hello.

Is it possible to make the plugin compatible with new redmine 5?

There seems to be a compatibility issue with the new Zeitwerk loader.

Thanks in advance.

JanB97 commented 2 years ago

I managed to get it to work for me, but there are still issues. Search isn't working and reload isn't either. I can send you my files if you want, as I can not remember what all I changed anymore.

lluisgener commented 2 years ago

If you can, I would appreciate it.

Thanks.

noshutdown-ru-user commented 2 years ago

Our debt is growing but we will try

noshutdown-ru-user commented 2 years ago

pls append your changed or you can open PR with changes

JanB97 commented 2 years ago

I tried making a PR, but it doesn't notice my changes but tells me that everything is different. Here are my files, as I said it is working for me, but not perfect.

Just as info, the new loader seems to require a specific structure and also specific "classes" within this structure. I just added a empty variable in that case to get rid of the error but I guess to make it rubust you would have to redo how the plugin is setup.

vault.zip

CSCSxx commented 2 years ago

I also played a while...but it didn't work...would be great if it runs on Redmine 5!

lluisgener commented 2 years ago

I made the attached vault.zip by @JanB97 work by adding this to the gemfile:

if Gem::Version.new(redmine_version_major) >= Gem::Version.new('4') gem 'protected_attributes_continued', '1.8.2' end

and replacing line 112 in keys_controller.rb for:

if @key.update(params[:vault_key])

It seems to read the previous keys, and I've been able to add, update and delete new ones. I don't know if I need to test much more.

CSCSxx commented 2 years ago

I made the attached vault.zip by @JanB97 work by adding this to the gemfile:

if Gem::Version.new(redmine_version_major) >= Gem::Version.new('4') gem 'protected_attributes_continued', '1.8.2' end

and replacing line 112 in keys_controller.rb for:

if @key.update(params[:vault_key])

It seems to read the previous keys, and I've been able to add, update and delete new ones. I don't know if I need to test much more.

Oh cool, works with the gem! However, I fear that the gem will eventually stop working - but it's a great workaround, at least for now Thanks :)

rohitthakral commented 2 years ago

Ok so I have tried the change by @JanB97 and the updates by @lluisgener as well but I keep getting this:

Zeitwerk::NameError: expected file /opt/redmine/plugins/vault/lib/mk_keyfiles_dir.rb to define constant MkKeyfilesDir, but didn't
/var/lib/gems/2.7.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/callbacks.rb:25:in `on_file_autoloaded'
/var/lib/gems/2.7.0/gems/zeitwerk-2.6.4/lib/zeitwerk/kernel.rb:42:in `require'
rohitthakral commented 2 years ago

Ignore, I was trying to use the repository and not the zip provided by @JanB97 .

Thank you guys for your help. I will try and see if I can commit this through my repository and get back to you with a merge request.