Class: Lcms::Engine::Admin::UsersController

Inherits:
AdminController show all
Defined in:
app/controllers/lcms/engine/admin/users_controller.rb

Constant Summary

Constants inherited from AdminController

AdminController::RE_GOOGLE_FOLDER

Instance Method Summary collapse

Methods inherited from AdminController

settings

Methods included from PathHelper

#dynamic_document_path, #dynamic_material_path, #dynamic_path

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/lcms/engine/admin/users_controller.rb', line 19

def create
  @user = User.new(user_params)
  @user.generate_password
  if @user.save
    @user.send_reset_password_instructions
    redirect_to lcms_engine.admin_users_path, notice: t('.success', user: @user.email)
  else
    render :new
  end
end

#destroyObject



43
44
45
46
# File 'app/controllers/lcms/engine/admin/users_controller.rb', line 43

def destroy
  @user.destroy
  redirect_to lcms_engine.admin_users_path, notice: t('.success')
end

#editObject



30
31
32
# File 'app/controllers/lcms/engine/admin/users_controller.rb', line 30

def edit
  @url = lcms_engine.admin_user_path(@user)
end

#indexObject



10
11
12
13
# File 'app/controllers/lcms/engine/admin/users_controller.rb', line 10

def index
  @query = OpenStruct.new @query_params # rubocop:disable Style/OpenStructUse
  @users = users(@query)
end

#newObject



15
16
17
# File 'app/controllers/lcms/engine/admin/users_controller.rb', line 15

def new
  @user = User.new
end

#reset_passwordObject



48
49
50
51
# File 'app/controllers/lcms/engine/admin/users_controller.rb', line 48

def reset_password
  @user.send_reset_password_instructions
  redirect_to lcms_engine.admin_users_path, notice: t('.success')
end

#updateObject



34
35
36
37
38
39
40
41
# File 'app/controllers/lcms/engine/admin/users_controller.rb', line 34

def update
  if @user.update(user_params)
    redirect_to lcms_engine.admin_users_path, notice: t('.success', user: @user.email)
  else
    @url = lcms_engine.admin_user_path(@user)
    render :edit
  end
end