Welcome, System Administrator!
This guide covers all administrative functions in the SWL Library Management System. As an admin, you have full system control including user management, catalog oversight, and system configuration.Getting Started
Administrator Access
Auto-redirect to User Management
After successful login, you’re redirected to
/users - the user management pageAdministrators have access to all features available to librarians, plus exclusive user and system management capabilities.
User Management
User management is the primary administrative function.Accessing User Management
Navigate to/users to see all registered users with:
- Pagination (10 users per page)
- User details (name, document ID, email, role, program)
- Action buttons for each user (edit, delete)
- Forms for creating new users and bulk import
Creating New Users
Fill User Creation Form
Enter the following information:
- Full Name: User’s complete name
- Document ID: Unique identifier (will be username)
- Email: User’s email address (must be unique)
- Phone: Contact phone number
- Role: Select from:
cliente(Student)premium(Premium User)bibliotecario(Librarian)admin(Administrator)
- Program Name: Required only for ‘cliente’ role
- Password: Initial password for the user
Submit
Click create. The system will:
- Validate uniqueness of document ID and email
- Hash the password securely
- Set program_name to NULL for non-cliente roles
- Add user to database
Route Reference: User creation is handled at
/users/create (POST method)Searching Users
Quickly find users with the search feature:Search Filters
The system searches across:
- Full name (case-insensitive)
- Document ID (case-insensitive)
Editing Users
Modify Fields
You can update:
- Full name
- Phone number
- Role
- Program name (for cliente role)
- Password (optional - leave blank to keep current password)
Route Reference: User editing is at
/users/edit/<user_id> (POST method)Cannot Edit:
- Document ID (system identifier)
- Email address (use as unique contact identifier)
Deleting Users
System Validation
The system checks:
- You’re not deleting your own account (prevented)
- User exists in database
Bulk User Import
For importing multiple users at once:Bulk import details depend on the ImportForm implementation. Check form validation for required format.
Dashboard and Loan Oversight
Administrators have full access to the librarian dashboard.Accessing the Dashboard
Navigate to/dashboard to view:
Loan Statistics
- Pending requests count
- Active loans count
- Returned items count
- Overdue loans count
Top Borrowed Items
Top 5 most-requested catalog items with loan counts
Status Filtering
Filter loans by: pendiente, activo, devuelto, atrasado
Loan Management
Approve, reject, and process returns for all loans
Loan Management Operations
Administrators can perform all librarian functions:- Approve Loans:
/approve/<loan_id>(POST) - Reject Loans:
/reject/<loan_id>(POST) - Process Returns:
/loan/<loan_id>/return(POST)
For detailed loan management procedures, see the Librarian Guide.
Catalog and Inventory Management
Catalog Administration
Full catalog control at/catalog:
Create Catalog Entries
Add new catalog items:
- Title or Name
- Category (libro, computo, general)
- Author or Brand
Instance Management
Manage physical inventory at/catalog/<catalog_id>/instances:
Add Instances
Create physical item records:
- Unique Code: Barcode, serial number, or identifier
- Condition: Description of physical condition
- Status: disponible, mantenimiento, perdido
Update Instance Status
Change status for maintenance or lost itemsRoute:
/instance/update_status/<instance_id> (POST)System Configuration
Penalty Fee Configuration
The system uses a configurable penalty fee for overdue books:Penalty changes only affect new overdue periods. Existing frozen penalties (
final_penalty) are not retroactively updated.Loan Duration Configuration
Default loan period is 15 days, set inLoanService.create_loan():
Automated Overdue Detection
The system runs a background scheduler to detect overdue loans:- Function:
LoanService.check_overdue_loans() - Action: Changes ‘activo’ loans to ‘atrasado’ when due_date < current_time
- Frequency: Configured in your scheduler setup
To modify scheduler frequency, check your APScheduler configuration in the Flask app initialization.
Reports and Statistics
Dashboard Statistics
The admin dashboard provides real-time metrics:- Pending Count: Requests awaiting approval
- Active Count: Currently loaned items
- Returned Count: Successfully returned items
- Overdue Count: Items past due date
Top Items Report
View the 5 most popular items:- High-demand items (consider adding more instances)
- Usage patterns by category
- Inventory expansion opportunities
Custom Reporting
For advanced reporting:Key Tables
user: User accounts and rolescatalog: Catalog entriesitem_instance: Physical inventoryloan: All loan transactionslibrary_log: Visitor activity logs
Role-Based Access Control
Understand the role hierarchy:- Admin
- Bibliotecario
- Cliente
Full System Access:
- All librarian functions
- User creation, editing, deletion
- System configuration
- Access to all routes
/users (user management)Implementing Role Checks
The system uses the@role_required decorator:
Routes without role decorators are accessible to all authenticated users.
User Journey Management
Upgrading Users
To upgrade a standard student to premium:Creating Librarian Accounts
Creating Admin Accounts
Best Practices
User Management
User Management
- Use consistent document ID formats (e.g., student IDs)
- Verify email addresses are valid before creating accounts
- Set strong initial passwords and advise users to change them
- Regularly audit user accounts for inactive or duplicate entries
- Document role changes for accountability
Security
Security
- Limit the number of admin accounts
- Never share admin credentials
- Regularly review user roles to ensure appropriate access
- Monitor deletion actions to prevent data loss
- Use the self-deletion prevention feature wisely
Catalog Management
Catalog Management
- Use descriptive titles and author/brand information
- Maintain consistent category naming
- Regularly audit catalog for duplicate entries
- Remove obsolete catalog items after deleting all instances
Inventory Management
Inventory Management
- Use systematic unique codes (e.g., “LAPTOP-001”, “BOOK-ISBN”)
- Document condition descriptions consistently
- Promptly mark lost or damaged items
- Conduct regular physical inventory checks
System Configuration
System Configuration
- Document all configuration changes
- Test penalty rate changes with sample calculations
- Schedule configuration updates during low-usage periods
- Back up database before major changes
Monitoring and Reporting
Monitoring and Reporting
- Review dashboard statistics daily
- Monitor top items for inventory planning
- Track overdue rates to identify systemic issues
- Generate regular usage reports for stakeholders
Troubleshooting Admin Issues
Cannot Create User - Duplicate Error
Cannot Create User - Duplicate Error
Cause: Document ID or email already existsSolution:
- Search for existing user with that document ID or email
- If found, edit existing user instead
- If not found, check for typos in your input
- Verify database integrity
User Deletion Fails
User Deletion Fails
Cause: Attempting to delete own accountSolution:
- Use another admin account to delete the user
- Or keep the account active
- System prevents self-deletion for safety
Role Change Doesn't Take Effect
Role Change Doesn't Take Effect
Cause: User session cached old roleSolution:
- User must log out and log back in
- Browser cache may need clearing
- Verify database was updated successfully
Catalog Item Cannot Be Deleted
Catalog Item Cannot Be Deleted
Cause: Instances still existSolution:
- Navigate to instance management for that catalog
- Delete all instances first (if not in active loans)
- Return to catalog and delete the entry
Statistics Don't Match Expected Values
Statistics Don't Match Expected Values
Cause: Database query or status inconsistencySolution:
- Refresh the dashboard page
- Verify loan statuses are accurate
- Check for stale data
- Run database integrity check
Quick Reference: Admin Routes
| Function | Route | Method | Access |
|---|---|---|---|
| User Management | /users | GET | Admin |
| Search Users | /users/search?search=<term> | GET | Admin |
| Create User | /users/create | POST | Admin |
| Edit User | /users/edit/<user_id> | POST | Admin |
| Delete User | /users/delete/<user_id> | POST | Admin |
| Bulk Import | /users/bulk_import | POST | Admin |
| Admin Dashboard | /dashboard | GET | Admin, Bibliotecario |
| Approve Loan | /approve/<loan_id> | POST | Admin, Bibliotecario |
| Reject Loan | /reject/<loan_id> | POST | Admin, Bibliotecario |
| Process Return | /loan/<loan_id>/return | POST | Admin, Bibliotecario |
| Catalog Management | /catalog | GET/POST | Admin, Bibliotecario |
| Instance Management | /catalog/<catalog_id>/instances | GET/POST | Admin, Bibliotecario |
| Update Instance | /instance/update_status/<instance_id> | POST | Admin, Bibliotecario |
| Delete Instance | /instance/delete/<instance_id> | POST | Admin, Bibliotecario |
Database Schema Reference
Key tables and relationships:User Table
Catalog Table
ItemInstance Table
Loan Table
Need Help?
Technical Support
For system errors, database issues, or technical problems, consult the development team or system documentation.
Policy Guidance
For user management policies, penalty rates, or operational procedures, refer to organizational guidelines.
User Training
To train librarians or premium users, use this documentation as reference material.
You’re fully equipped to administer the SWL Library Management System with confidence!