anteo / redmine_custom_workflows

Allows to create custom workflows for Redmine
http://www.redmine.org/plugins/custom-workflows
GNU General Public License v2.0
182 stars 72 forks source link

Q: check for REST API access (user impersonation or remote IP) in workflow #280

Closed albrechtd closed 2 years ago

albrechtd commented 2 years ago

First, this plugin is really great!

My problem: in a workflow, I would like to distinguish between a “real” browser session, and API access w/ user impersonation from a specific server. I think this could be done

Is it possible to get this information within the workflow?

picman commented 2 years ago

All those information are available in controllers. But we work with models in the plugin. I see no way how to get these information in the workflow script.

albrechtd commented 2 years ago

All those information are available in controllers. But we work with models in the plugin. I see no way how to get these information in the workflow script.

That's really a pity – thanks a lot for you explanation anyway. If you have any idea how I could solve my task, any input would be highly appreciated!

picman commented 2 years ago

The remote IP should be available now as follows. Try it, please, in the devel branch.

self.custom_workflow_env[:remote_ip]
albrechtd commented 2 years ago

Thanks a lot for your changes, great work!

Unfortunately I forgot to mention that I'm running Redmine on a Debian Buster system, using the deb packages from buster-backports which are still v. 4.0.7, packages for Bullseye are not (yet) available, and I don't want to run Bookworm on a productive system. Thus, I still use the latest plugin which is compatible with 4.0, which is v. 1.0.1…

However, I hacked v. 1.0.1 for issues (the part relevant for me) by adding snippets from your related commit, and this seems to work perfectly. I performed only a few tests, though, but they behave exactly as expected.

picman commented 2 years ago

Great!