Class: Hyrax::DepositorsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Hyrax::DepositorsController
- Includes:
- DenyAccessOverrideBehavior
- Defined in:
- app/controllers/hyrax/depositors_controller.rb
Instance Method Summary collapse
Methods included from DenyAccessOverrideBehavior
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/hyrax/depositors_controller.rb', line 8 def create grantor = grantee = ::User.from_url_component(params[:grantee_id]) if grantor.can_receive_deposits_from.include?(grantee) head :ok else grantor.can_receive_deposits_from << grantee (grantor, grantee) render json: { name: grantee.name, delete_path: hyrax.user_depositor_path(grantor.user_key, grantee.user_key) } end end |
#destroy ⇒ Object
20 21 22 23 24 |
# File 'app/controllers/hyrax/depositors_controller.rb', line 20 def destroy grantor = grantor.can_receive_deposits_from.delete(::User.from_url_component(params[:id])) head :ok end |
#validate_users ⇒ Object
26 27 28 |
# File 'app/controllers/hyrax/depositors_controller.rb', line 26 def validate_users head :ok if params[:user_id] == params[:grantee_id] end |