Skip to content

Commit

Permalink
Merge pull request #978 from openedx/cag/block-instructors
Browse files Browse the repository at this point in the history
feat: allow to block instructor access
  • Loading branch information
Cristhian Garcia authored Nov 14, 2024
2 parents 636d9ae + b90e22b commit c73d2e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions tutoraspects/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@
# course cache anyway.
("SUPERSET_USER_PERMISSIONS_CACHE_TIMEOUT", 120),
("SUPERSET_BLOCK_STUDENT_ACCESS", True),
("SUPERSET_BLOCK_INSTRUCTOR_ACCESS", False),
# This setting allows Superset to run behind a reverse proxy in HTTPS and
# redirect to the correct http/s based on the headers sent from the proxy.
# By default it is on if Caddy is enabled, but it can be set separately in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def _get_user_roles(self, username, locale):
# the course permissions cache if necessary by logging out and back in.
courses = self.get_courses(username, force=True)
if courses:
if {{ SUPERSET_BLOCK_INSTRUCTOR_ACCESS }}:
raise Exception(f"Instructor {username} tried to access Superset")
return ["instructor", f"instructor-{locale}"]
else:
roles = self.extra_get_user_roles(username, decoded_access_token)
Expand Down

0 comments on commit c73d2e3

Please sign in to comment.