10_User_List_Interface - Anisan/osysHome-Users GitHub Wiki
Relevant source files
The following files were used as context for generating this wiki page:
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.
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"]
Sources: templates/users.html:5-36
The User List Interface is implemented through a combination of a Flask route handler and an HTML template:
- The controller in the
Users
class within__init__.py
retrieves user data - The
users.html
template renders the interface with Bootstrap styling - 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
Sources: init.py:31-94, templates/users.html:1-36
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
The User List Interface provides several management actions for administrators:
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.
Each user entry in the table has three action buttons:
- Edit - Opens the user profile editing interface, allowing modifications to the user's details
- Set Password - Opens the password management interface for setting a new password
- 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
Sources: templates/users.html:6-31, init.py:32-69
The Users
plugin class handles the rendering and processing of the User List Interface. When accessed without a specific operation, the controller:
- Retrieves all user objects using
getObjectsByClass("Users")
- Passes the user collection to the template
- 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.
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:
- Breadcrumb navigation
- Add user action button
- User data table with columns for user properties
- 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
The User List Interface integrates with several other components of the system:
- User Profile Interface - Accessed via the "Edit" action button
- Password Management Interface - Accessed via the "Set Password" action button
- User Data Model - Displays properties from the User objects
-
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