Class: Hyrax::DepositorsController

Inherits:
ApplicationController
  • Object
show all
Includes:
DenyAccessOverrideBehavior
Defined in:
app/controllers/hyrax/depositors_controller.rb

Instance Method Summary collapse

Methods included from DenyAccessOverrideBehavior

#deny_access

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/hyrax/depositors_controller.rb', line 8

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



20
21
22
23
24
# File 'app/controllers/hyrax/depositors_controller.rb', line 20

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

#validate_usersObject



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