Closed EnziinSystem closed 3 years ago
Hi @EnziinSystem , usually access to manage of mautic connections should be restricted only for authorized users - not for everyone in applicatin.
See comment: "Set authorize condition for manage Mautic::Connections"
Thats why you need adjuct configuration according to you application. For example in devise
or authlogic
is method current_user
with User object...
See https://github.com/luk4s/mautic-rails/blob/aaf2e4c2b2562be2cad45d5bab871b9710be446e/app/controllers/mautic/connections_controller.rb#L9
So ajdust this setting (authorize_mautic_connections) according to your application. OR you can include connections concern to YOUR controller https://github.com/luk4s/mautic-rails/blob/master/app/controllers/concerns/mautic/connections_controller_concern.rb and deal with permissions by yourself.
I hope this will help you.
I solved by remove Mautic.config.authorize_mautic_connections and change routes:
authenticate :user, ->(u) { AdminUser.exists?(email: u.email) } do
mount Mautic::Engine => "/mautic"
end
Then I login with admin account, go to the "/mautic/connections" but I get the error assset compiled.
Sprockets::Rails::Helper::AssetNotPrecompiled in Mautic::Connections#index
Showing /usr/local/bundle/bundler/gems/mautic-rails-044d413a2f09/app/views/layouts/mautic/application.html.erb where line #5 raised:
mautic/application.css
Rails 6.1.0 Ruby 2.7.2 gem 'sass-rails', '~> 6.0'
Yop, thats because mautic_manifest missing probably. But you are right, its unecessary completely - because there is no JS or CSS for gem. I will remove it...
It's worked! Thank you.
I have an application Mautic is running.
Now, I add the gem to exist Rails app.
In the Gemfile:
In the config/initializers/mautic.rb:
In the config/routes.rb
When I get "/mautic/connections"
Because you created this gem, it is very simple for you but not for everyone. I can't set it up to work, please be more detailed instructions.