-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Roles 15 - permission checks back end changes part 1 #33347
Roles 15 - permission checks back end changes part 1 #33347
Conversation
common/djangoapps/student/auth.py
Outdated
# Limited Course Staff does not have access to Studio. | ||
# TODO: course roles: Remove this validation when course roles are implemented |
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.
Consider adding clarity by explaining which type of course roles you mean (student_courseaccessrole, django_comment_client_role, or course_roles_roles)
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.
I wanted to refer to the course_roles Django App . What you think about changing the comment to: "# TODO: course roles: Remove this validation when implementing course_roles django app."?
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.
I think that is a positive change.
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.
done
6b26674
into
ROLES-2-course_roles_setup
* test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings
* test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings
* test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings
* test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings
* test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings
* test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings
* test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings
* feat: Roles 15 - permission checks back end changes part 1 (#33347) * test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings * feat: ROLES-23 Create permissions in db table (#33394) * feat: add migration to load permissions in the database * feat: add Permission enum * feat: change Permission enum name to CourseRolesPermission * feat: replace permission constants with the CourseRolesPermission enum * feat: add unique decorator to permissions enum * feat: add course_roles_permissions dict with names and descriptions (with i18n) * docs: add CourseRolesPermission docstring * style: fix pylint errors * style: fix pylint errors * docs: add permissions module docstring * feat: add helper function to get user permissions for a course * test: add test for get_all_user_permissions_for_a_course * feat: add views to coures roles api * test: add test for course roles views * feat: add urls for course roles api * feat: add course roles api urls to lms and cms * docs: add comment to indicate which urls are from course roles api * feat: add translation to ValueError exception message * feat: add translation to ValueError exception message * feat: raise exeption if course does not exist * feat: add instance permissions in get_all_user_permissions_for_a_course helper * feat: improve validations in get_all_user_permissions_for_a_course * feat: improve validations in UserPermissionsView * test: update get user permissions tests * docs: update UserPermissionsView docstring * feat: change message errors * docs: update docstrings in test_views * fix: add missing super method call in a class * fix: add password to test user * fix: chain re-raising exceptions
* test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings
* test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings
* feat: Roles 15 - permission checks back end changes part 1 (#33347) * test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings * feat: ROLES-23 Create permissions in db table (#33394) * feat: add migration to load permissions in the database * feat: add Permission enum * feat: change Permission enum name to CourseRolesPermission * feat: replace permission constants with the CourseRolesPermission enum * feat: add unique decorator to permissions enum * feat: add course_roles_permissions dict with names and descriptions (with i18n) * docs: add CourseRolesPermission docstring * style: fix pylint errors * style: fix pylint errors * docs: add permissions module docstring * feat: add helper function to get user permissions for a course * test: add test for get_all_user_permissions_for_a_course * feat: add views to coures roles api * test: add test for course roles views * feat: add urls for course roles api * feat: add course roles api urls to lms and cms * docs: add comment to indicate which urls are from course roles api * feat: add translation to ValueError exception message * feat: add translation to ValueError exception message * feat: raise exeption if course does not exist * feat: add instance permissions in get_all_user_permissions_for_a_course helper * feat: improve validations in get_all_user_permissions_for_a_course * feat: improve validations in UserPermissionsView * test: update get user permissions tests * docs: update UserPermissionsView docstring * feat: change message errors * docs: update docstrings in test_views * fix: add missing super method call in a class * fix: add password to test user * fix: chain re-raising exceptions
* test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings
* feat: Roles 15 - permission checks back end changes part 1 (#33347) * test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings * feat: ROLES-23 Create permissions in db table (#33394) * feat: add migration to load permissions in the database * feat: add Permission enum * feat: change Permission enum name to CourseRolesPermission * feat: replace permission constants with the CourseRolesPermission enum * feat: add unique decorator to permissions enum * feat: add course_roles_permissions dict with names and descriptions (with i18n) * docs: add CourseRolesPermission docstring * style: fix pylint errors * style: fix pylint errors * docs: add permissions module docstring * feat: add helper function to get user permissions for a course * test: add test for get_all_user_permissions_for_a_course * feat: add views to coures roles api * test: add test for course roles views * feat: add urls for course roles api * feat: add course roles api urls to lms and cms * docs: add comment to indicate which urls are from course roles api * feat: add translation to ValueError exception message * feat: add translation to ValueError exception message * feat: raise exeption if course does not exist * feat: add instance permissions in get_all_user_permissions_for_a_course helper * feat: improve validations in get_all_user_permissions_for_a_course * feat: improve validations in UserPermissionsView * test: update get user permissions tests * docs: update UserPermissionsView docstring * feat: change message errors * docs: update docstrings in test_views * fix: add missing super method call in a class * fix: add password to test user * fix: chain re-raising exceptions
* feat: Roles 15 - permission checks back end changes part 1 (#33347) * test: add test cases for permission list check functions * test: update tests * feat: add helper functions to check lists of permissions * style: improve code style * feat: add course roles checks in the contentstore app * feat: add course roles checks in the student app * feat: add course roles checks in the lms discussion app * feat: add course roles checks in the lms instructor app * feat: add course roles checks in the Learning Sequences package * style: fix code style * fix: course_permission_check calls * feat: add validation for AnonymousUser in course permission check helper functions * fix: disable some pylint warnings * test: update number of querys asserted in has_course_author_access * feat: add helper functions to check course or organization permissions * test: update course_roles tests * feat: replace course or organization helper functions in auth * docs: update course_roles docstrings * feat: ROLES-23 Create permissions in db table (#33394) * feat: add migration to load permissions in the database * feat: add Permission enum * feat: change Permission enum name to CourseRolesPermission * feat: replace permission constants with the CourseRolesPermission enum * feat: add unique decorator to permissions enum * feat: add course_roles_permissions dict with names and descriptions (with i18n) * docs: add CourseRolesPermission docstring * style: fix pylint errors * style: fix pylint errors * docs: add permissions module docstring * feat: add helper function to get user permissions for a course * test: add test for get_all_user_permissions_for_a_course * feat: add views to coures roles api * test: add test for course roles views * feat: add urls for course roles api * feat: add course roles api urls to lms and cms * docs: add comment to indicate which urls are from course roles api * feat: add translation to ValueError exception message * feat: add translation to ValueError exception message * feat: raise exeption if course does not exist * feat: add instance permissions in get_all_user_permissions_for_a_course helper * feat: improve validations in get_all_user_permissions_for_a_course * feat: improve validations in UserPermissionsView * test: update get user permissions tests * docs: update UserPermissionsView docstring * feat: change message errors * docs: update docstrings in test_views * fix: add missing super method call in a class * fix: add password to test user * fix: chain re-raising exceptions
Description
This PR is a PR to a feature branch.
This PR adds a check for a permission in the different places in the CMS/studio codebase where a role is currently checked.
Changes
add helper functions to check a list of permissions
add helper functions to check organization or course permissions
update related tests
add validation for AnonymousUser permission check helper functions
add permission checks in the contentstore app
add permission checks in the student app
add permission checks in the lms discussion app
add permission checks in the lms instructor app
add permission checks in the Learning Sequences package