ucsdlib / damspas-rd

A Digital Collections application based on Hyrax
MIT License
3 stars 2 forks source link

Add authentication and authorization #139

Closed VivianChu closed 6 years ago

VivianChu commented 7 years ago

Fixes #125 ; refs #125

Implement SSO (authentication) + AD/LDAP (authorization).

@ucsdlib/developers - please review

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.3%) to 90.458% when pulling e0bcf1b38c4b445702c13be2608fc2d7554f2ae3 on feature/ad_ldap into a8f133a7f31417ece7f71c73c9d5b6433de04870 on develop.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.6%) to 91.214% when pulling cc6a892a5a99a68fbaf197e8545ca3b56738001a on feature/ad_ldap into a8f133a7f31417ece7f71c73c9d5b6433de04870 on develop.

VivianChu commented 7 years ago

@mcritchlow @lsitu - I tried Longshou's suggestion before it doesn't work. I tried again today and still got that error. I think it's because it failed at this part https://github.com/ucsdlib/horton/blob/feature/ad_ldap/spec/controllers/batch_import_controller_spec.rb#L58 https://github.com/ucsdlib/horton/blob/develop/app/models/user.rb#L3

because it called hyrax:user model

1) BatchImportController Excel XL metadata source #create enqueue an update job is successful Failure/Error: log.success!

 ActiveModel::UnknownAttributeError:
   unknown attribute 'password' for User.
mcritchlow commented 7 years ago

That's odd. Using @lsitu's suggestion, your just overriding the methods defined in the module in the included class.

Is there a stacktrace, or any additional info from byebug? I'm curious where/why it's bypassing the methods you're defining locally.

VivianChu commented 7 years ago

@mcritchlow - It related to the structure of the module hyrax:user

Here's the stack trace. It does call back to hyrax:user class. It doesn't use these methods in model/user.rb

 # /Users/tchu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/bundler/gems/hyrax-9f117a32a9fd/app/models/concerns/hyrax/user.rb:163:in `find_or_create_system_user'
 # /Users/tchu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/bundler/gems/hyrax-9f117a32a9fd/app/models/concerns/hyrax/user.rb:146:in `audit_user'
 # /Users/tchu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/bundler/gems/hyrax-9f117a32a9fd/app/services/hyrax/message_user_service.rb:27:in `job_user'
 # /Users/tchu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/bundler/gems/hyrax-9f117a32a9fd/app/services/hyrax/message_user_service.rb:11:in `call'
 # /Users/tchu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/bundler/gems/hyrax-9f117a32a9fd/config/initializers/hyrax_callbacks.rb:29:in `block in <top (required)>'
lsitu commented 7 years ago

@VivianChu I've added a commit https://github.com/ucsdlib/horton/pull/139/commits/1f0bfdd1c1e85af2500ee1ddefd612043ea26eb1 that works in my local environment as we discussed this morning. Could you do a clean checkout to see whether it works for you?

VivianChu commented 7 years ago

@lsitu - It works for me. Thanks.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.7%) to 91.108% when pulling c6a60eb5dfb975069c1a38abccc4fb6b8ca92222 on feature/ad_ldap into a8f133a7f31417ece7f71c73c9d5b6433de04870 on develop.

VivianChu commented 6 years ago

@ucsdlib/developers - please review, comment, etc... Thanks

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.7%) to 91.242% when pulling 3a20aede9443cf4d9f4e6ca7a6b211145fcd5017 on feature/ad_ldap into 172d66d1a93ae2dbfda0783e78a484c2f7ce1b65 on develop.

VivianChu commented 6 years ago

@ucsdlib/developers - The commits have been merged for easier review. Thanks

hweng commented 6 years ago

:+1: