-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Wiki page locking #397
Comments
@ebarry - input on list of pages to lock? |
Okay so what should I do first? |
Try making a test to ensure a non-admin cannot edit a locked page. Then you
should see the PR travis checks fail, and then you can try to implement
that feature in the controller action `update` -- make sense?
…On Fri, Dec 16, 2016 at 12:58 PM, Swapnil Gupta ***@***.***> wrote:
Okay so what should I do first?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#397 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ9b69GH907vDoOJppzTQ1-DOdfexks5rItFGgaJpZM4Hr-y6>
.
|
Okay so this test will do I guess
end |
Yes, I believe that's right -- you might also use an `assert_redirected_to`
-- and this should correctly test this because the default user in the
wiki_controller_test.rb is "bob" -- a regular user.
…On Fri, Dec 16, 2016 at 1:02 PM, Swapnil Gupta ***@***.***> wrote:
Okay so this test will do I guess
test "basic user blocked from updating a locked wiki page" do
node(:organizers).add_tag('locked', rusers(:admin)) # lock the page with
a tag
# then try updating it
post :update,
id: node(:organizers).id,
uid: rusers(:bob).id,
title: ""
assert_template "wiki/show"
assert_select ".alert", "expected message"
end
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#397 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ2r157dYyRwED82b7VYNMiMXISbLks5rItIygaJpZM4Hr-y6>
.
|
Okay I have opened a PR #1114 |
* Added test to block basic user edits * Added feature * upate wiki_controller_test.rb * Update wiki_controller_test.rb * Update wiki_controller_test.rb * Update wiki_controller_test.rb * Update wiki_controller_test.rb * Update wiki_controller_test.rb * Update on flash[] * Added flash test * update wiki_controller.rb * update * Removed assert_select * removed assert flash * removed assert_redirected_to test * Update * Back to 961812c state * Update wiki_controller_test.rb
#1114 merged -- now just need the same but for the wiki |
I have added a PR #1155 for update action. Please have a look! |
I'm going to reopen and suggest one more addition -- a test that admins do not get redirected, but can indeed both Thanks!!! |
Also, i'd like to request that this line be modified to link to the https://github.com/publiclab/plots2/blob/master/app/views/wiki/show.html.erb#L45 That way it's easier for admins and mods to actually make edits! |
@jywarren Yeah I can add. But where should I add the test? |
You could put it alongside the ones that test disallowing normal users'
edits. Thanks!
…On Tue, Jan 3, 2017 at 2:00 PM, Swapnil Gupta ***@***.***> wrote:
@jywarren <https://github.com/jywarren> Yeah I can add. But where should
I add the test?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#397 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ6zYiNQ1KLEBRjxxowh7_bV7QXj-ks5rOprZgaJpZM4Hr-y6>
.
|
I made a PR #1163. Please have a look. |
Overview
For extremely cautious use, for around 10 or so "most visible" pages on the site and/or those related to the staff only (board, for example), we need some locking abilities. Pages like:
Admins (
user.role == "admin"
) would have ability to lock, and moderators to edit locked pages. We'd show a clear message indicating that it's locked and why, and a way to appeal this, probably by linking to now-draft https://publiclab.org/wiki/moderation. in an alert.Update: as of #1095, tag creation permissions are done and we now just have to disallow the
edit
andupdate
actions on https://github.com/publiclab/plots2/blob/master/app/controllers/wiki_controller.rb -- See Tasks, below.Goal is to keep locking to an absolute minimum -- only for the most trafficked and spam-hit pages. Wiki page edit notifications for anything else. (#396)
Tasks
/tag/locked
, from an explanation page at https://publiclab.org/wiki/locked (that'll be done in Add "lock" icon and de-linkify Edit tab of "locked" wiki pages #1099)/wiki/locked
: https://publiclab.org/wiki/power-tagsedit
page. Look to see if the "locked" tag exists, and if it does, redirects back to the wiki page with an error message, by adding just after this line: https://github.com/publiclab/plots2/blob/master/app/controllers/wiki_controller.rb#L74 as follows (complete in Added test to block basic user edits, closes issue #397 #1114):def update
in the same controller (for when you clicksave
on a wiki page), except that we'd want to put all of these lines in anelse
block, so they don't get run if there's a lock:https://github.com/publiclab/plots2/blob/master/app/controllers/wiki_controller.rb#L137-L173
locked
to a page in a test, and make sure a normal user can't edit that page. A test of a wiki page (example: https://github.com/publiclab/plots2/blob/master/test/functional/wiki_controller_test.rb#L124-L133) looks like this:This issue needs breaking up!
The text was updated successfully, but these errors were encountered: