TrestleAdmin / trestle-auth

Authentication plugin for the Trestle admin framework
https://trestle.io
GNU Lesser General Public License v3.0
52 stars 23 forks source link

Purpose / How to configure to use existing model #13

Open timdiggins opened 6 years ago

timdiggins commented 6 years ago

I've been using trestle happily with my own hand-rolled auth (basically doing Trestle::ApplicationController.send(:include, MyAuthConcern in a Trestle.configure block).

However I wanted to add trestle-sidekiq to the mix and it requires trestle-auth.

I was surprised that the generator for trestle-auth just made a model -- I thought it might just generate an initializer (a la Devise).

Is the purpose of Trestle Auth just to provide a model etc, or to be more of a generic framework for auth ?

I'm happy to contribute, but not at all sure how yet.

spohlenz commented 6 years ago

The generator for trestle-auth both generates a default model as well as injects (mostly commented) configuration code into an existing config/initializers/trestle.rb.

If you are using an existing model, then you should be able to delete the generated model & migration, and customize the configuration variables and blocks to suit your own model. If you find that the existing hooks are too limited for your use case, please open an issue (or PR) and we'll see how it can best be resolved.

timdiggins commented 6 years ago

Thank you (so quick too!). I've can see the modifications to the initializer now (I had to remove some of my code from config/initializers/trestle.rb so didn't spot that the file had also been modified by the generator).