Skip to content
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

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

marcospri
Copy link
Member

@marcospri marcospri commented Jul 26, 2024

Applies the same pattern as #6467 to assignments and users

Testing

As a teacher and admin

@@ -8,14 +8,16 @@


class DashboardService:
def __init__(self, db, assignment_service, course_service, organization_service):
self._db = db
def __init__(
Copy link
Member Author

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,
Copy link
Member Author

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.
Copy link
Member Author

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.

@marcospri marcospri requested a review from acelaya July 29, 2024 08:00
@marcospri marcospri marked this pull request as ready for review July 29, 2024 08:01
Copy link
Contributor

@acelaya acelaya left a 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.

@marcospri marcospri merged commit 2ec7601 into api-course-metrics Jul 29, 2024
9 checks passed
@marcospri marcospri deleted the admin-access branch July 29, 2024 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants