Skip to content

Stricter permissions for the wiki#1502

Merged
symbolist merged 1 commit intomasterfrom
usman/lms1355-wiki-permissions
Nov 13, 2013
Merged

Stricter permissions for the wiki#1502
symbolist merged 1 commit intomasterfrom
usman/lms1355-wiki-permissions

Conversation

@symbolist
Copy link
Contributor

https://edx-wiki.atlassian.net/browse/LMS-1355

CAN_DELETE: Whether the user should be able to (soft) delete an article.
CAN_MODERATE: Actually 'Delete' only hides articles. This setting can allow a user to view 'deleted' articles and purge or restore them. This seems to be turned off for everyone right now so no-one can restore 'deleted' articles.

Every article can be assigned a django user group.
CAN_CHANGE_PERMISSIONS: Whether the user has the ability to change permissions on an article. If allowed the user can make the article unreadable or unwritable to anyone who is not in the article user group.
CAN_ASSIGN: Whether the user can change the owner/user group of the article. This also controls whether the user can lock the article from any edits.

For all four settings the new defaults are:

  1. Django staff and superuser can admin all wiki articles.
  2. Course instructors/staff can admin articles belonging to their course wiki subtree only.

@cpennington adam says you know most about the wiki so can you look at this?
@adampalay

Copy link
Contributor

Choose a reason for hiding this comment

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

Make this more clear that it's hypothetical

@sarina
Copy link
Contributor

sarina commented Nov 8, 2013

Your coverage report has some missing lines: https://jenkins.testeng.edx.org/job/edx-platform-report/383/Diff_Coverage_Report/?
Can tests be added to cover those.

Additionally, please rebase to squash commits as necessary, and add the JIRA ticket number to the commit message itself. Once comments are addressed please ping me, I'm happy to re-review to give thumbs up.

@sarina
Copy link
Contributor

sarina commented Nov 8, 2013

I ran a new build on your branch. If you click the "Details" link, you can see the reports. Please review the diff-coverage and diff-quality reports, which you can see on the left-hand side of the page.

Please especially review the diff-quality report. You introduce a ton of quality violations that need to be cleaned up. Also be sure you're familiar with https://github.com/edx/edx-platform/wiki/Python-Guidelines

@symbolist
Copy link
Contributor Author

@sarina Thanks! Let me look at all of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sarina You commented on this section earlier suggesting this:

if course_slug is None:
    return False

if (course_slug.endswith('_') and course_wiki_slug_is_numerical(course_slug[:-1]):
    course_slug = course_slug[:-1]

if user_is_staff_on_course_number(user, course_slug):
    return True
return False

Consider the course with course number 202_. Its instructor group will be named something like "instructor_mitx/202_/fall" and its course slug will be "202_". Since this ends with an underscore and 202 is a number course_slug will be set to "202" and so the above simplification will not work. Hence the need for the two checks.

However I have refactored this a bit so that there is only one db access.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, great. And thanks for the comment explaining why you need to call user_is_staff_on_course_number twice - that's the part I had the largest concern about.

@symbolist
Copy link
Contributor Author

@sarina I have cleaned up all the pylint/pep8 issues and updated according to your suggestions. Can you look at this again?

Copy link
Contributor

Choose a reason for hiding this comment

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

instead of pylint: disable=C0103 you can use the name of the error message, which is clearer. So change these to instead, pylint: disable=invalid-name

@sarina
Copy link
Contributor

sarina commented Nov 12, 2013

Reports and refactored code look good. I just had a few more comments, once addressed this looks good to me.

@symbolist
Copy link
Contributor Author

@sarina Refactored tests and fixed the other issues.

P.S. With your stringent standards you should be made the chief reviewer for all PRs. :)

@sarina
Copy link
Contributor

sarina commented Nov 12, 2013

@symbolist but now you will be chief awesomest code writer 😁

@sarina
Copy link
Contributor

sarina commented Nov 12, 2013

Once tests pass, 👍

@adampalay
Copy link
Contributor

👍 2

symbolist pushed a commit that referenced this pull request Nov 13, 2013
@symbolist symbolist merged commit e370fb9 into master Nov 13, 2013
@symbolist symbolist deleted the usman/lms1355-wiki-permissions branch November 13, 2013 10:44
jenkins-ks pushed a commit to nttks/edx-platform that referenced this pull request Dec 21, 2016
xirdneh pushed a commit to open-craft/openedx-platform that referenced this pull request Jun 12, 2019
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