fix access control
This commit is contained in:
5 files changed
+18
-3
No files matched your search
@@ -1,3 +1,5 @@
|
|||||||
|
SET search_path TO lab_tracker_group_22;
|
||||||
|
|
||||||
-- 1.
|
-- 1.
|
||||||
SELECT le_section_id, lab_set_code, course_code, la_title, lab_day_of_week
|
SELECT le_section_id, lab_set_code, course_code, la_title, lab_day_of_week
|
||||||
FROM lab_event
|
FROM lab_event
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
SET search_path TO lab_tracker_group_22;
|
||||||
|
|
||||||
CREATE OR REPLACE VIEW ta_view AS
|
CREATE OR REPLACE VIEW ta_view AS
|
||||||
SELECT
|
SELECT
|
||||||
ls.lab_section_id AS lab_section,
|
ls.lab_section_id AS lab_section,
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
|
SET search_path TO lab_tracker_group_22;
|
||||||
|
|
||||||
-- 1. Create a role for TAs
|
-- 1. Create a role for TAs
|
||||||
CREATE ROLE ta_role;
|
CREATE ROLE ta_role;
|
||||||
|
|
||||||
-- 2. Allow this role to view your TA-related views
|
-- 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)
|
-- 3. Create a demo user
|
||||||
CREATE USER ta_demo WITH PASSWORD 'ta_demo123';
|
CREATE USER ta_demo WITH PASSWORD 'superdupercoolta69';
|
||||||
|
|
||||||
-- 4. Give the demo user the TA role
|
-- 4. Give the demo user the TA role
|
||||||
GRANT ta_role TO ta_demo;
|
GRANT ta_role TO ta_demo;
|
||||||
|
|
||||||
|
-- test
|
||||||
|
SET ROLE ta_role;
|
||||||
|
|
||||||
|
SELECT * FROM ta_view;
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
SET search_path TO lab_tracker_group_22;
|
||||||
|
|
||||||
-- Clean DB before inserting
|
-- Clean DB before inserting
|
||||||
TRUNCATE TABLE progress_change_log CASCADE;
|
TRUNCATE TABLE progress_change_log CASCADE;
|
||||||
TRUNCATE TABLE progress CASCADE;
|
TRUNCATE TABLE progress CASCADE;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
SET search_path TO lab_tracker_group_22;
|
||||||
|
|
||||||
-- Show all students with their section info Should work
|
-- 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
|
SELECT s.student_first_name, s.student_last_name, ls.lab_course_code, c.course_title, t.term_name
|
||||||
|
|||||||
Reference in new issue
Block a user