Class: Securial::UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- Securial::UsersController
- Defined in:
- app/controllers/securial/users_controller.rb
Overview
UsersController
Controller for managing users in the Securial authentication system.
This controller provides administrative CRUD operations for user management, including:
- Listing all users in the system
- Creating new user accounts
- Viewing user details
- Updating user information
- Deleting user accounts
All operations require admin authentication and are typically used for administrative user management rather than self-service account management.
Routes typically mounted at Securial/admins/users/* in the host application.
Instance Method Summary collapse
-
#create ⇒ void
Creates a new user in the system.
-
#destroy ⇒ void
Deletes an existing user.
-
#index ⇒ void
Lists all users in the system.
-
#securial_user_params ⇒ ActionController::Parameters
private
Permits and extracts user parameters from the request.
-
#set_securial_user ⇒ void
private
Finds and sets a specific user for show, update and destroy actions.
-
#show ⇒ void
Shows details for a specific user.
-
#update ⇒ void
Updates an existing user.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ void
This method returns an undefined value.
Creates a new user in the system.
Adds a new user with the provided attributes.
46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/securial/users_controller.rb', line 46 def create @securial_user = User.new(securial_user_params) if @securial_user.save render :show, status: :created, location: @securial_user else render json: @securial_user.errors, status: :unprocessable_entity end end |
#destroy ⇒ void
This method returns an undefined value.
Deletes an existing user.
Permanently removes a user from the system.
77 78 79 80 |
# File 'app/controllers/securial/users_controller.rb', line 77 def destroy @securial_user.destroy head :no_content end |
#index ⇒ void
This method returns an undefined value.
Lists all users in the system.
Retrieves all users for administrative display and management.
27 28 29 |
# File 'app/controllers/securial/users_controller.rb', line 27 def index @securial_users = User.all end |
#securial_user_params ⇒ ActionController::Parameters (private)
Permits and extracts user parameters from the request.
95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'app/controllers/securial/users_controller.rb', line 95 def securial_user_params params.expect(securial_user: [ :email_address, :username, :first_name, :last_name, :phone, :bio, :password, :password_confirmation, ]) end |
#set_securial_user ⇒ void (private)
This method returns an undefined value.
Finds and sets a specific user for show, update and destroy actions.
88 89 90 |
# File 'app/controllers/securial/users_controller.rb', line 88 def set_securial_user @securial_user = User.find(params[:id]) end |
#show ⇒ void
This method returns an undefined value.
Shows details for a specific user.
Retrieves and displays information for a single user.
37 38 |
# File 'app/controllers/securial/users_controller.rb', line 37 def show end |
#update ⇒ void
This method returns an undefined value.
Updates an existing user.
Modifies the attributes of an existing user.
63 64 65 66 67 68 69 |
# File 'app/controllers/securial/users_controller.rb', line 63 def update if @securial_user.update(securial_user_params) render :show, status: :ok, location: @securial_user else render json: @securial_user.errors, status: :unprocessable_entity end end |