prey / gdpr_rails

Rails Engine for the GDPR compliance
https://preyproject.com
MIT License
626 stars 62 forks source link

Adding the possibility to specify an AdminUser #7

Closed EtienneDepaulis closed 6 years ago

EtienneDepaulis commented 6 years ago

Hello guys,

on our app we have a User model for our users and an AdminUser model for our admin users. This PR adds the possibility to specify this behavior in the configuration:

PolicyManager::Config.setup do |c|
  c.admin_user_resource = AdminUser
end

PolicyManager::UserTermsController.send(:include, Devise::Controllers::Helpers)

I had to fix the display of the navbar as when you are logged in as an AdminUser you don't have any terms to accept (which is a common user action).

Todo :

I've also taken the liberty to:

What do you think of this feature ?

coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 30


Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/policy_manager/config.rb 4 8 50.0%
<!-- Total: 5 9 55.56% -->
Files with Coverage Reduction New Missed Lines %
test/dummy/app/models/user.rb 1 55.56%
<!-- Total: 1 -->
Totals Coverage Status
Change from base Build 28: -0.5%
Covered Lines: 737
Relevant Lines: 792

💛 - Coveralls
michelson commented 6 years ago

Hi @EtienneDepaulis , this is a great addition to the library. I will test this in our implementation before merge, but overall it looks good to me. best!