Page MenuHomePhabricator

Don't show "edit with form" tab if user don't have permissions to edit the page
Closed, DeclinedPublic

Description

Author: sergey.chernyshev

Description:
If user can't edit the page, there is no point to show "Edit with form" tab so let's disable it.


Version: unspecified
Severity: enhancement

Details

Reference
bz11403

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 9:57 PM
bzimport set Reference to bz11403.

sergey.chernyshev wrote:

Disables "Edit with form" tab if user don't have permissions to edit the page

This patch is made against 0.5.7 but it seems to be the issue in latest release as well.

Attached:

sergey.chernyshev wrote:

(In reply to comment #1)

I'm puzzled - is that from the same guy who wrote this? :)

Looks like the same guy ;)

The problem is that even being logged in, user is not necessarily allowed to edit the page (e.g. if user is restricted to only edit their own page or if page is simply protected by admin) - in this case there is no real point for showing the tab and disabled form.

Do you think it makes sense to separate "Logged out" case from "Not allowed" case?

Well, right now the "edit" tab always appears, even if you can't edit; though it often shows up as "view source" when you can't edit the page. I like the fact that you can always at least see which pages are form-editable, and what the form looks like. What about just renaming the tab to, say, "view form", if you lack the permission to edit for any reason?

sergey.chernyshev wrote:

Yeh, renaming it is good, but also, I'd make it optionally removable based on configuration parameter.

sergey.chernyshev wrote:

Strange, but my patch is having trouble with some pages

$target_title = Title::newFromText($target_name);

returns nothing.

(In reply to comment #6)

Strange, but my patch is having trouble with some pages

$target_title = Title::newFromText($target_name);

returns nothing.

It returns either a Title object, or null. In the latter case, $target_name is an invalid title. You can check for this with is_null($target_title)

sergey.chernyshev wrote:

Thank you, I'll try to debug - it did freak out on a subpage with parenthesis so maybe there is some sort of title escaping needs to be done.

I'm changing this to "WONTFIX": the tab now shows up as "view form" if the user can't edit the page - I don't see a need to ever hide the tab completely.

sergey.chernyshev wrote:

By default it makes sense to have it like this, but it should be possible to remove tab completely with some configuration parameter - many people build sites where "edit" appears only when it's allowed.

Sergey

Dispute resolved, after some private discussion - apparently there's no automatic way to hide the "edit" tab either. Setting back to "won't fix".