When checking permissions for wiki look at dot format role names too. - #2559
Conversation
|
@adampalay @sarina A few months back you reviewed a PR which added granular permissions for course wikis. Course role groups have a new format now (type_org.number.run). This PR adds support for recognising users as staff on course wikis if they are members of the new dot format role groups. |
|
@symbolist this makes sense to me, but I am unfamiliar with the new format. I'd recommend also tagging whomever is responsible for that change to make sure everything has been implemented correctly. |
|
@dmitchell Can you give this a look? |
There was a problem hiding this comment.
the double underscore is confusing... can you do course_310b2 or something?
|
👎 Please convert to use CourseStaffRole and CourseInstructorRole from roles.py. I'm sorry I didn't change these usages here when I centralized that. |
|
@dmitchell I am not sure where CourseStaff/InstructorRole should be used here? From a wiki article we can only extract the course number and not the whole course id. Given this constraint |
|
I'm going to pull your branch and add a function for getting the list of courses which contain a given wiki id. You then will remove all of your permission checking code and replace it with |
|
Note, I didn't add the version for split mongo yet as it's more complex |
There was a problem hiding this comment.
add some commas:
To maintain backwards compatibility, the default value of use_unique_wiki_id is False. However, when creating a course in studio, use_unique_wiki_id will be set to True. So, new courses will use a unique wiki_id. XML courses will need to explicitly set use_unique_wiki_id to true in the policy file.
|
@symbolist I don't understand how this will resolve LMS-2112... unless it's not meant to |
|
I'm also getting an error when I try to run this branch locally: |
|
@dmitchell I have refactored this after our last conversation. Can you give it a review? Thanks. |
There was a problem hiding this comment.
Nitpick, don't put args to Location constructor in a list, just use them directly. (Nitpick meaning you don't need to change it but I'd prefer the change)
|
A few minor cleanups but overall 👍 (no need for re-review) |
|
👍 |
…odulestores. This method returns a list of courses which use the particular wiki_slug. It is used for checking permissions in the course_wiki app. LMS-2136
CourseRole names have a new format (type_org.number.run). Previously when checking if a user was staff for a course wiki type_org/number/run and type_number format role names were checked by parsing user group names. This logic has been refactored to first fetch all courses which use the particular wiki_slug and then use courseware.access.has_access to check if the user has staff permissions on any of the courses. LMS-2136
Currently wiki_slug is set to course number. However, since multiple courses can have the same number this may lead to clashes. So wiki_slug will be set to org.course.name. To maintain the active wiki_slugs for xml courses this cannot be changed in the CourseDescriptor. LMS-2136
Refactor of permissions checking for wiki pages.
CourseRole names have a new format (type_org.number.run). Previously
when checking if a user was staff for a course wiki only type_org/number/run
and type_number format role names were checked. Now type.org.number.run
format names are also checked.
LMS-2136