10_User_List_Interface - Anisan/osysHome-Users GitHub Wiki

User List Interface

Relevant source files

The following files were used as context for generating this wiki page:

Purpose and Scope

The User List Interface provides administrators with a centralized view for managing user accounts within the osysHome system. This interface allows administrators to view all registered users in a tabular format and perform essential user management operations. For detailed information about editing individual user profiles, see User Profile Interface. For password management functionality, see Password Management Interface.

Interface Overview

The User List Interface is implemented as a table-based view that displays all users registered in the system along with their key attributes and action buttons for management operations.

flowchart TD
    A["User List Interface"]
    A --> B["User Management Actions"]
    A --> C["User Data Display Table"]
    
    B --> B1["Add User Button"]
    B --> B2["Edit User Button"]
    B --> B3["Set Password Button"]
    B --> B4["Delete User Button"]
    
    C --> C1["Username with Avatar"]
    C --> C2["Role Information"]
    C --> C3["Home Page Setting"]
    C --> C4["Last Login Timestamp"]
Loading

Sources: templates/users.html:5-36

Implementation Details

The User List Interface is implemented through a combination of a Flask route handler and an HTML template:

  1. The controller in the Users class within __init__.py retrieves user data
  2. The users.html template renders the interface with Bootstrap styling
  3. Action buttons are linked to specific operations through URL query parameters
sequenceDiagram
    participant Client
    participant "Users Plugin" as Plugin
    participant "Core Functions" as Core
    participant "users.html" as Template
    
    Client->>Plugin: Request Users admin page
    Plugin->>Core: getObjectsByClass("Users")
    Core-->>Plugin: Return users list
    Plugin->>Template: Render with users data
    Template-->>Client: Display users table
    
    Client->>Plugin: Click action button
    Note over Plugin: Process op parameter (add/edit/delete/setPassword)
    Plugin-->>Client: Respond with appropriate view
Loading

Sources: init.py:31-94, templates/users.html:1-36

User Data Display

The User List Interface displays the following information for each user in a tabular format:

Column Description Source Property
Username User's login name with avatar user.name, user.image
Role User's permission level user.role
Home Page Default page after login user.home_page
Last Login Timestamp of last successful login user.lastLogin
Actions Management buttons N/A

Each user's entry includes a small circular avatar image (30x30 pixels) displayed next to their username. If the user has no custom avatar or the image fails to load, a default avatar from /Users/static/Users.png is shown.

Sources: templates/users.html:7-35

Available Actions

The User List Interface provides several management actions for administrators:

Add User

A green "Add user" button at the top of the interface allows administrators to create new user accounts. Clicking this button redirects to the user creation form with the op=add parameter.

Per-User Actions

Each user entry in the table has three action buttons:

  1. Edit - Opens the user profile editing interface, allowing modifications to the user's details
  2. Set Password - Opens the password management interface for setting a new password
  3. Delete - Removes the user from the system after confirmation
graph TD
    A["User List Interface"] --> B["Add New User"]
    A --> C["Per-User Actions"]
    
    B --> B1["User Creation Form"]
    
    C --> C1["Edit User"]
    C --> C2["Set Password"]
    C --> C3["Delete User"]
    
    C1 --> D1["User Profile Form"]
    C2 --> D2["Password Form"]
    C3 --> D3["Confirmation Dialog"]
    
    D1 --> E["Update User in Database"]
    D2 --> F["Set User Password"]
    D3 -- "Confirm" --> G["Remove User"]
    D3 -- "Cancel" --> A
Loading

Sources: templates/users.html:6-31, init.py:32-69

Controller Implementation

The Users plugin class handles the rendering and processing of the User List Interface. When accessed without a specific operation, the controller:

  1. Retrieves all user objects using getObjectsByClass("Users")
  2. Passes the user collection to the template
  3. Renders the users.html template

When an operation is requested via the op parameter, the controller processes the appropriate action (add, edit, delete, or setPassword) before potentially redirecting back to the user list.

The relevant code can be found in init.py:31-94, with the specific user listing logic at init.py:89-94.

Template Structure

The users.html template extends a common admin layout (layouts/module_admin.html) and implements a specialized view for the user listing. The template includes:

  1. Breadcrumb navigation
  2. Add user action button
  3. User data table with columns for user properties
  4. Action buttons for each user entry

The template iterates through the provided users collection and generates a table row for each user with their data and associated action buttons.

Sources: templates/users.html:1-36

Integration Points

The User List Interface integrates with several other components of the system:

  1. User Profile Interface - Accessed via the "Edit" action button
  2. Password Management Interface - Accessed via the "Set Password" action button
  3. User Data Model - Displays properties from the User objects
  4. Core Data Functions - Utilizes getObjectsByClass to retrieve users

The interface acts as the central hub for user management operations, from which administrators can navigate to more specific management interfaces.

Sources: init.py:31-94, templates/users.html:1-36

⚠️ **GitHub.com Fallback** ⚠️