Class: Curate::DepositorsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Sufia::Noid
Defined in:
app/controllers/curate/depositors_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/curate/depositors_controller.rb', line 12

def create
  response = {}
  unless params[:person_id] == params[:grantee_id]
    grantor = Person.find(params[:person_id])
    authorize! :edit, grantor
    grantee = Person.find(params[:grantee_id])
    unless grantor.user.can_receive_deposits_from.include? (grantee.user)
      grantor.user.can_receive_deposits_from << grantee.user
      response = {name: grantee.name, delete_path: person_depositor_path(grantor, grantee) }
    end
  end
  respond_to do |format|
    format.json { render json: response}
  end

end

#destroyObject



29
30
31
32
33
34
35
36
# File 'app/controllers/curate/depositors_controller.rb', line 29

def destroy
  grantor = Person.find(params[:person_id])
  authorize! :edit, grantor
  grantor.user.can_receive_deposits_from.delete(Person.find(params[:id]).user)
  respond_to do |format|
    format.json { head :no_content }
  end
end

#indexObject



9
10
# File 'app/controllers/curate/depositors_controller.rb', line 9

def index
end