fix access control

This commit is contained in:
SowinskiBraeden committed 2025-11-28 17:07:17 -08:00
1 parent d676f7d68c
commit b134fc0fe7
5 files changed
+18 -3

No files matched your search

+2
View File
@@ -1,3 +1,5 @@
SET search_path TO lab_tracker_group_22;
-- 1.
SELECT le_section_id, lab_set_code, course_code, la_title, lab_day_of_week
FROM lab_event
+2
View File
@@ -1,3 +1,5 @@
SET search_path TO lab_tracker_group_22;
CREATE OR REPLACE VIEW ta_view AS
SELECT
ls.lab_section_id AS lab_section,
+11 -3
View File
@@ -1,11 +1,19 @@
SET search_path TO lab_tracker_group_22;
-- 1. Create a role for TAs
CREATE ROLE ta_role;
-- 2. Allow this role to view your TA-related views
GRANT SELECT ON v_ta_progress_summary, v_section_overview TO ta_role;
GRANT SELECT ON ta_view, v_section_overview TO ta_role;
GRANT USAGE ON SCHEMA lab_tracker_group_22 TO ta_role;
-- 3. Create a demo user (only works if your server allows user creation)
CREATE USER ta_demo WITH PASSWORD 'ta_demo123';
-- 3. Create a demo user
CREATE USER ta_demo WITH PASSWORD 'superdupercoolta69';
-- 4. Give the demo user the TA role
GRANT ta_role TO ta_demo;
-- test
SET ROLE ta_role;
SELECT * FROM ta_view;
+2
View File
@@ -1,3 +1,5 @@
SET search_path TO lab_tracker_group_22;
-- Clean DB before inserting
TRUNCATE TABLE progress_change_log CASCADE;
TRUNCATE TABLE progress CASCADE;
+1
View File
@@ -1,3 +1,4 @@
SET search_path TO lab_tracker_group_22;
-- Show all students with their section info Should work
SELECT s.student_first_name, s.student_last_name, ls.lab_course_code, c.course_title, t.term_name