Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Support Installation & Updates
  1. OpenProject
  2. Forums
  3. Support Installation & Updates
  4. PLUGIN GENERATOR - some advice for generating OmniAuth

PLUGIN GENERATOR - some advice for generating OmniAuth

Added by art vanderhoff over 10 years ago

Hello,

I have installed V4.0 and want to use the OmniAuth plugin. I hada look for v4.0 specific instructions but could not find any. I did however find the following older link
https://github.com/opf/openproject-auth_plugins

This contains the instruction
" The first step is to generate a new plugin."

I could not find a direct link but again found a page
https://community.openproject.org/news/26-openproject-plugin-generaor-released

This page contains the following instruction

Writing a new OpenProject plugin is now as easy as: bundle exec rails generate open_project:plugin <plugin name> <target folder> Just include gem "openproject-plugins", "~> 1.0.2"

Can someone give me some details on what <plugin name> <target folder> means. IE is the target folder a sub folder of the openproject folder etc or in one of the folders below.

Then the second part…Just include in

When I search for engine.rb, I get the following list
/home/user/.gem/ruby/2.0/bundler/gems/sass-rails-0393d9e1a6e4/test/fixtures/engine_project/lib/engine_project/engine.rb /home/user/.gem/ruby/2.0/gems/arel-3.0.3/lib/arel/sql/engine.rb /home/user/.gem/ruby/2.0/gems/i18n-js-3.0.0.rc6/lib/i18n/js/engine.rb /home/user/.gem/ruby/2.0/gems/rabl-0.9.3/lib/rabl/engine.rb /home/user/.gem/ruby/2.0/gems/yard-0.8.7.2/lib/yard/templates/engine.rb /home/user/.gem/ruby/2.0/gems/livingstyleguide-1.2.0/lib/livingstyleguide/engine.rb /home/user/.gem/ruby/2.0/gems/bourbon-4.0.0/lib/bourbon/engine.rb /home/user/.gem/ruby/2.0/gems/sass-3.3.14/lib/sass/engine.rb /home/user/.gem/ruby/2.0/gems/erubis-2.7.0/lib/erubis/engine.rb /home/user/.gem/ruby/2.0/gems/railties-3.2.19/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb /home/user/.gem/ruby/2.0/gems/railties-3.2.19/lib/rails/engine.rb

Any advice or a link to getting OmniAuth up and running would be very much appreciated.

Thx
Art


Replies (2)

RE: PLUGIN GENERATOR - some advice for generating OmniAuth - Added by Markus Kahl over 10 years ago

Hey Art,

sorry for the the late reply but here it goes:

When you generate a plugin (you need the OpenProject core for that) in will create the engine.rb for you.

git clone https://github.com/opf/openproject.git

cd openproject

# if you don't use RVM that's fine, this is just how I would do it:
echo ruby-2.1.1 > .ruby-version
echo openproject > .ruby-gemset
# now a `cd .` should suffice, but to make sure the first time we do the following:
rvm use ruby-2.1.1
rvm gemset --create use openproject

echo "gem 'openproject-auth_plugins', :git => 'https://github.com/opf/openproject-auth_plugins.git', :branch => 'release/4.0'" >> Gemfile.plugins

bundle # install gems

rails generate rails generate open_project:plugin my_auth_plugin plugins

The output of the last command will be something like the following:

TextileConverterBlockquoteStart09339cab-f4f4-4739-85b0-d02ba1f342e6

rails generate open_project:plugin my_auth_plugin plugins

TextileConverterBlockquoteEnd09339cab-f4f4-4739-85b0-d02ba1f342e6

require 'rails/all'... 0.390s
Bundler.require... 1.420s
Application.initialize!... [deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
1.530s
      create  plugins/openproject-my_auth_plugin
      create  plugins/openproject-my_auth_plugin/openproject-my_auth_plugin.gemspec
      create  plugins/openproject-my_auth_plugin/CHANGELOG.md
      create  plugins/openproject-my_auth_plugin/README.md
      create  plugins/openproject-my_auth_plugin/lib
      create  plugins/openproject-my_auth_plugin/lib/openproject-my_auth_plugin.rb
      create  plugins/openproject-my_auth_plugin/lib/open_project/my_auth_plugin.rb
      create  plugins/openproject-my_auth_plugin/lib/open_project/my_auth_plugin/engine.rb
      create  plugins/openproject-my_auth_plugin/lib/open_project/my_auth_plugin/version.rb

So here I just created the plugin in a subfolder of OpenProject. It doesn’t really matter where you put it, though.
Also, don’t ask me why but you have to have your config/database.yml configured with a valid connection for the plugin generator to work …

Anyway, the engine.rb you are looking for now is in ./plugins/openproject-my_auth_plugin/lib/open_project/my_auth_plugin/engine.rb

For more infos about this topic you may refer to the OmniAuth auth plugin guide “[1]”:https://community.openproject.org/projects/openproject/wiki/Developing_an_OmniAuth_Authentication_Plugin or have a look at a very simple example plugin “[2]”:https://github.com/machisuji/openproject-mock_auth I wrote.

Hope I could help a little!
If you have any further questions, don’t hesitate to ask.

~ Markus

[1] https://community.openproject.org/projects/openproject/wiki/Developing_an_OmniAuth_Authentication_Plugin
[2] https://github.com/machisuji/openproject-mock_auth

RE: PLUGIN GENERATOR - some advice for generating OmniAuth - Added by art vanderhoff over 10 years ago

Thanks for the detailed post Markus, I am working through your steps.
Can you also point me to any tutorials on how to include html/php apps within that plugin. For example I have a php app on the same web server and would like to include that in a plugin, ;looking like this

myUrl.com/phpApp/showinfo.php

should also be available from

myUrl.com/projects/MyProjectA -> MyExtraContent(package) -> shows myUrl.com/phpApp/showinfo.php

thanks
Art

  • (1 - 2/2)
Loading...