🔍 Role Mapping Investigation
📋 Tables in Database:
- tbl_activities
- tbl_add_info
- tbl_advisory
- tbl_attendance
- tbl_comm_group
- tbl_comm_group_message
- tbl_comm_group_read
- tbl_communication
- tbl_meetings
- tbl_notification_admin_views
- tbl_notification_recipients
- tbl_notifications
- tbl_otp_verification
- tbl_overall_progress
- tbl_overall_progress_links
- tbl_overall_summaries
- tbl_parents_profile
- tbl_progress_cards
- tbl_progress_comments
- tbl_progress_notification
- tbl_quarter_feedback
- tbl_quarters
- tbl_risk_levels
- tbl_risk_summaries
- tbl_roles
- tbl_routines
- tbl_schedule
- tbl_schedule_items
- tbl_shapes
- tbl_student_assigned
- tbl_student_levels
- tbl_student_milestone_interpretation
- tbl_students
- tbl_subject_overall_progress
- tbl_subjects
- tbl_system_logs
- tbl_tracking_adventurer
- tbl_tracking_discoverer
- tbl_tracking_explorer
- tbl_users
- tbl_visual_feedback
🎭 Looking for Role Tables:
✅ Found role-related tables:
📊 Structure of tbl_roles:
Column | Type | Null | Key | Default | Extra |
---|
role_id | int(11) | NO | PRI | | auto_increment |
role_name | varchar(50) | NO | | | |
Sample Data from tbl_roles:
role_id | role_name |
---|
1 | Super Admin |
2 | Admin |
3 | Teacher |
4 | Parent |
👥 Current User Roles in tbl_users:
Role ID | User Count |
---|
1 | 1 |
2 | 9 |
3 | 11 |
4 | 20 |
👤 Sample Users with Role ID 1:
User ID | Name | Role ID |
---|
1 | Chansss Clarino | 1 |
👤 Sample Users with Role ID 2:
User ID | Name | Role ID |
---|
2 | Kristopher Dichos | 2 |
3 | Andrew Nerona | 2 |
13 | Juliet Roms | 2 |
👤 Sample Users with Role ID 3:
User ID | Name | Role ID |
---|
4 | Angela Borres | 3 |
5 | Jessa Decena | 3 |
9 | Jess Morcillos | 3 |
👤 Sample Users with Role ID 4:
User ID | Name | Role ID |
---|
6 | Carla Tan | 4 |
7 | Bryan Lopez | 4 |
8 | Elaine Mendoza | 4 |
🔗 Frontend Role Mapping:
Based on the frontend code, these string roles are expected:
"Admin"
"SuperAdmin"
"Super Admin"
"Teacher"
"Parent"
But the database uses numeric role IDs. We need to create a mapping!
💡 Solution Options:
- Create a role mapping table to translate between numeric IDs and string names
- Update the frontend to use numeric role IDs instead of strings
- Update the backend to handle both numeric and string role checks
🚀 Recommended Approach:
Create a simple role mapping table and update the backend to handle both formats.
-- Create role mapping table
CREATE TABLE IF NOT EXISTS tbl_role_mapping (
role_id INT PRIMARY KEY,
role_name VARCHAR(50) NOT NULL,
role_display_name VARCHAR(100) NOT NULL
);
-- Insert common roles
INSERT INTO tbl_role_mapping (role_id, role_name, role_display_name) VALUES
(1, 'SuperAdmin', 'Super Admin'),
(2, 'Admin', 'Admin'),
(3, 'Teacher', 'Teacher'),
(4, 'Parent', 'Parent');