Module: Sufia::DepositorsControllerBehavior
- Extended by:
- ActiveSupport::Concern
- Included in:
- DepositorsController
- Defined in:
- app/controllers/concerns/sufia/depositors_controller_behavior.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/concerns/sufia/depositors_controller_behavior.rb', line 10 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 render json: { name: grantee.name, delete_path: sufia.user_depositor_path(grantor.user_key, grantee.user_key) } end end |
#destroy ⇒ Object
21 22 23 24 25 |
# File 'app/controllers/concerns/sufia/depositors_controller_behavior.rb', line 21 def destroy grantor = grantor.can_receive_deposits_from.delete(::User.from_url_component(params[:id])) head :ok end |
#validate_users ⇒ Object
27 28 29 30 31 |
# File 'app/controllers/concerns/sufia/depositors_controller_behavior.rb', line 27 def validate_users if params[:user_id] == params[:grantee_id] head :ok end end |