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

Add permission checks to role checks - courseware, learner home, teams, content #33991

Merged
merged 7 commits into from
Jan 19, 2024

Conversation

hsinkoff
Copy link
Member

@hsinkoff hsinkoff commented Jan 2, 2024

Description

This PR adds permissions checks alongside the existing roles checks for course level permissions in courseware, learner_home, teams, and content. These permissions are designed to be assigned to course level roles that will be assigned to a user.

This PR should have no immediate impact on any users. Later PRs will create new course_roles and migrate existing student_courseaccessrole user roles to the new course_roles user roles. Only after that time will these permissions grant access to courseware, learner_home, teams, and content.

Supporting information

course_roles tech spec

Testing instructions

Testing will be completed on the feature branch once additional services have been updated to add permissions checks. Testing will involve creating a course_roles role and assigning it to a user. This user will then be used to confirm the correct access is granted to the user.

Other information

This is a PR to a feature branch.

@hsinkoff hsinkoff changed the base branch from master to CourseRoles January 2, 2024 16:17
@hsinkoff hsinkoff force-pushed the CourseRoles branch 2 times, most recently from 4822202 to a63cae5 Compare January 2, 2024 19:55
@hsinkoff hsinkoff force-pushed the ROLES-65-roles_checks_to_permission_checks branch 6 times, most recently from 2006bd2 to 41cd6dc Compare January 3, 2024 18:41
@hsinkoff hsinkoff marked this pull request as ready for review January 3, 2024 19:40
@hsinkoff hsinkoff force-pushed the ROLES-65-roles_checks_to_permission_checks branch 8 times, most recently from 11fb831 to 8294f96 Compare January 9, 2024 18:59
@hsinkoff hsinkoff force-pushed the ROLES-65-roles_checks_to_permission_checks branch 4 times, most recently from 44428ef to 28f420f Compare January 11, 2024 16:37
@hsinkoff hsinkoff force-pushed the ROLES-65-roles_checks_to_permission_checks branch from 28f420f to 7c94e63 Compare January 12, 2024 16:14
Copy link
Contributor

@nsprenkle nsprenkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A casual read through looks good, with some questions for going forward.

Comment on lines +596 to +598
# The user_is_staff, user_is_beta_test, and user_role cannot be removed until
# all x-blocks have been updated to use permissions, once they have been updated
# remove role check in favor of permissions checks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a thought / question: how might we verify / track that blocks have moved over to the new permissions pattern? It is minority difficult to verify that all the internal blocks we own follow this permission pattern, but we will need to socialize this change well and mark it as a breaking change for Open edX release for environments with custom blocks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We agree that it will be necessary to socialize this change well and expect that removing some checks will wait longer than others. Likely this will be one that is done later in the process because of the complications you've mentioned.

if has_course_staff_privileges(user, course_key):
# TODO: remove role checks once course_roles is fully impelented and data is migrated
if (
has_course_staff_privileges(user, course_key) or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels redundant since has_course_staff_privileges asks the same has_perm check. Or is this just here for greater clarity?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added for clarity, but it does seem redundant and will be removed.

@hsinkoff hsinkoff merged commit 3333457 into CourseRoles Jan 19, 2024
62 checks passed
@hsinkoff hsinkoff deleted the ROLES-65-roles_checks_to_permission_checks branch January 19, 2024 21:13
hsinkoff added a commit that referenced this pull request Jan 22, 2024
…, teams, content (#33991)

* feat: courseware, learner home, teams, content role checks to permission checks
hsinkoff added a commit that referenced this pull request Feb 16, 2024
…, teams, content (#33991)

* feat: courseware, learner home, teams, content role checks to permission checks
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.

3 participants