pub async fn list_roles(pool: &Pool<MySql>) -> Result<Vec<Role>>
Expand description
Retrieves all roles in the system, ordered by creation time.
This function fetches all role records from the database, with the most recently created roles first. It provides a complete view of all roles defined in the system.
§Arguments
pool
- Database connection pool for executing the query
§Returns
Ok(Vec<Role>)
- Successfully retrieved list of rolesErr(anyhow::Error)
- Failed to fetch roles
§Use Cases
Common use cases include:
- Administrative interfaces for role management
- Role selection dropdowns in user management interfaces
- System audit and compliance reporting