-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce dashboard admin access for assignments and users #6475
Conversation
@@ -8,14 +8,16 @@ | |||
|
|||
|
|||
class DashboardService: | |||
def __init__(self, db, assignment_service, course_service, organization_service): | |||
self._db = db | |||
def __init__( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this module we check access to individual elements.
@@ -214,32 +217,51 @@ def is_member(self, assignment: Assignment, h_userid: str) -> bool: | |||
def get_assignments( | |||
self, | |||
instructor_h_userid: str | None = None, | |||
admin_organization_ids: list[int] | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same pattern as for courses, fetch assignments where the users is an instructor or an admin.
@@ -117,6 +121,7 @@ def get_users( # noqa: PLR0913, PLR0917 | |||
:param role_scope: return only users with this LTI role scope. | |||
:param role_type: return only users with this LTI role type. | |||
:param instructor_h_userid: return only users that belongs to courses/assignments where the user instructor_h_userid is an instructor. | |||
:param admin_organization_ids: organizations where the current user is an admin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fetch users from courses where the users is an instructor or an admin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general. I haven't fully tested it, but since this is not based in main
branch, let's do further testing once both PRs have been merged.
Applies the same pattern as #6467 to assignments and users
Testing
As a teacher and admin
[email protected]
as an admin the relevant organization, eg: http://localhost:8001/admin/orgs/1/dashboard-admins