Module: Hyrax::DepositorsControllerBehavior

Extended by:
ActiveSupport::Concern
Includes:
DenyAccessOverrideBehavior
Included in:
DepositorsController
Defined in:
app/controllers/concerns/hyrax/depositors_controller_behavior.rb

Instance Method Summary collapse

Methods included from DenyAccessOverrideBehavior

#deny_access

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/concerns/hyrax/depositors_controller_behavior.rb', line 11

def create
  grantor = authorize_and_return_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
    send_proxy_depositor_added_messages(grantor, grantee)
    render json: { name: grantee.name, delete_path: hyrax.user_depositor_path(grantor.user_key, grantee.user_key) }
  end
end

#destroyObject



23
24
25
26
27
# File 'app/controllers/concerns/hyrax/depositors_controller_behavior.rb', line 23

def destroy
  grantor = authorize_and_return_grantor
  grantor.can_receive_deposits_from.delete(::User.from_url_component(params[:id]))
  head :ok
end

#validate_usersObject



29
30
31
# File 'app/controllers/concerns/hyrax/depositors_controller_behavior.rb', line 29

def validate_users
  head :ok if params[:user_id] == params[:grantee_id]
end