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



17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/hyrax/depositors_controller.rb', line 17

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



29
30
31
32
33
# File 'app/controllers/hyrax/depositors_controller.rb', line 29

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

#indexObject



10
11
12
13
14
15
# File 'app/controllers/hyrax/depositors_controller.rb', line 10

def index
  add_breadcrumb t(:'hyrax.controls.home'), root_path
  add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
  add_breadcrumb t(:'hyrax.dashboard.manage_proxies'), hyrax.depositors_path
  @user = current_user
end

#validate_usersObject



35
36
37
# File 'app/controllers/hyrax/depositors_controller.rb', line 35

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