Class: Spotlight::AdminUsersController

Inherits:
ApplicationController show all
Includes:
Concerns::UserExistable, Concerns::UserInvitable
Defined in:
app/controllers/spotlight/admin_users_controller.rb

Overview

A controller to handle the adminstration of site admin users

Instance Method Summary collapse

Methods included from Concerns::UserInvitable

#invite

Methods included from Concerns::UserExistable

#exists

Methods included from Controller

#blacklight_config, #current_exhibit, #current_masthead, #current_masthead=, #current_site, #exhibit_masthead?, #exhibit_search_action_url, #exhibit_search_facet_url, #resource_masthead?, #search_action_url, #search_facet_url

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
# File 'app/controllers/spotlight/admin_users_controller.rb', line 15

def create
  if update_roles
    flash[:notice] = t('spotlight.admin_users.create.success')
  else
    flash[:error] = t('spotlight.admin_users.create.error')
  end
  redirect_to spotlight.admin_users_path
end

#destroyObject



24
25
26
27
28
29
30
31
32
# File 'app/controllers/spotlight/admin_users_controller.rb', line 24

def destroy
  user = Spotlight::Engine.user_class.find(params[:id])
  if user.roles.where(resource: @site).first.destroy
    flash[:notice] = t('spotlight.admin_users.destroy.success')
  else
    flash[:error] = t('spotlight.admin_users.destroy.error')
  end
  redirect_to spotlight.admin_users_path
end

#indexObject



12
13
# File 'app/controllers/spotlight/admin_users_controller.rb', line 12

def index
end