? Success

User tests: Successful: Unsuccessful:

avatar andrepereiradasilva
andrepereiradasilva
11 Nov 2016

Summary of Changes

As discussed in #12799 this PR makes a review of the ordering columns ACL across all backend views (isis and hathor).

Testing Instructions

Mainly code review, but you can test if featured view continues to work.

  • Apply patch
  • Without core.edit.state permission you can't change ordering columns in list views in isis and hathor.

Documentation Changes Required

None.

avatar andrepereiradasilva andrepereiradasilva - open - 11 Nov 2016
avatar andrepereiradasilva andrepereiradasilva - change - 11 Nov 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 11 Nov 2016
Category Administration com_banners com_content com_menus com_newsfeeds com_plugins com_tags com_users Templates (admin)
avatar andrepereiradasilva
andrepereiradasilva - comment - 11 Nov 2016

@ggppdk @csthomas as promised. Please test/check.

avatar andrepereiradasilva andrepereiradasilva - change - 11 Nov 2016
Title
[ACL] Backend order review
[ACL] Backend ordering columns in list views review
Labels Added: ?
avatar andrepereiradasilva andrepereiradasilva - edited - 11 Nov 2016
avatar andrepereiradasilva andrepereiradasilva - change - 11 Nov 2016
Title
[ACL] Backend order review
[ACL] Backend ordering columns in list views review
avatar andrepereiradasilva andrepereiradasilva - change - 11 Nov 2016
The description was changed
avatar andrepereiradasilva andrepereiradasilva - edited - 11 Nov 2016
avatar ggppdk
ggppdk - comment - 12 Nov 2016

@andrepereiradasilva

you found all places,
that calculate the "$canOrder" in the record listing template files: (tmpl/default.php)

Just the removal of the variable "$canOrder" is not best,
instead we should fix the wrong check, since

  • $canOrder is ACL check or core.edit.state on something (currently on wrong thing you found this)
  • $saveOrder is the check if current sorting is "*.ordering"

We should change, as you previously had pointed out, to something that makes sense, the component asset

$canOrder  = $user->authorise('core.edit.state', 'com_content.article');
$canOrder  = $user->authorise('core.edit.state', 'com_content');

If you do not do this

then the ordering will appear "inactive" for users with no core.edit.state on the component
(it will appear inactive because it does core.edit.state on the component too),

but the user despite drag-icons being inactive, can still drag the field,
ordering is not saved but a call is made towards server with no effect),
and this is confusing to the user and wrong

avatar ggppdk
ggppdk - comment - 12 Nov 2016

Adding to my previous reply, if category filter is acctive:
Instead of

$canOrder  = $user->authorise('core.edit.state', 'com_content');

use the category asset: (case we have soft-deny on component and then allow for specific category)

$filter_catid = $this->state->get('filter.category_id');
$canOrder = !$filter_catid ?
    $user->authorise('core.edit.state', 'com_content') :
    $user->authorise('core.edit.state', 'com_content.category.'.$filter_catid);

Maybe this will require some small changes for save order task too, to check category asset ?

avatar andrepereiradasilva
andrepereiradasilva - comment - 12 Nov 2016

you will never have a perfect behaviour in hathor, only if you introduce core.edit.order which imho would be an overkill just for this.

The thing is, in hathor, in the order column header is checking core.edit.state of the component but the rows are checking (and correctly) the category or item core.edit.state.

So, in the current behaviour, it can lead to a place where the user as no core.edit.state in the component (the order save button will not appear), but does have core.edit.state in some items (the order field will not appear).

We can, of course, mantain the current behavour, that is also not perfect.

I will do that them, ie, remove the not used $canOrder from isis and just correct the acl asset name in hathor. This will make it work like it was, but remove unused code and correct wrong acl asset names.

avatar andrepereiradasilva
andrepereiradasilva - comment - 12 Nov 2016

ok done, should be fine now

avatar ggppdk
ggppdk - comment - 12 Nov 2016

It looks good now,
but i am a little confused, why have you updated only the hathor template overrides ?

and what do you think about instead of:

$canOrder  = $user->authorise('core.edit.state', 'com_content');

using the category asset: (case we have soft-deny on component and then allow for specific category)

$filter_catid = $this->state->get('filter.category_id');
$canOrder = !$filter_catid ?
    $user->authorise('core.edit.state', 'com_content') :
    $user->authorise('core.edit.state', 'com_content.category.'.$filter_catid);

Thus have even more appropriate ACL checks that will work with soft-deny at component and core.edit.state granted on individual categories

I checked just now and it seems that

  • there is no need to update any FOF files,
  • and no need to update anything on saveOrderAjax task either of legacy admin controler, because it calls the saveorder() of the legacy admin model that already checks individual record (e.g. article) assets thus no need to update anything there too
avatar andrepereiradasilva
andrepereiradasilva - comment - 12 Nov 2016

but i am a little confused, why have you updated only the hathor template overrides ?

because $canOrderis only used in hathor templates, what i remvoed in isis in code that doesn't do anything because isis does not have the save butoon in the ordering column title.

and what do you think about instead of:

Honestly hathor is going to be removed in 4.0, i don't see the need to change it's behaviout at this point.

avatar ggppdk
ggppdk - comment - 12 Nov 2016

because $canOrderis only used in hathor templates, what i remvoed in isis in code that doesn't do anything because isis does not have the save butoon in the ordering column title.

no, it should be used for adding or not adding the JS of drag and drop re-ordering
if you do not use it, there are 2 problems

  • the drag elements appear disabled due to the "inactive" class being added, but user can still drag them
  • and when they is a drag operation, a server call is made (which of course fails to set the order because the saveorder() of legacy admin model checks ACL and disallows it)
avatar andrepereiradasilva
andrepereiradasilva - comment - 12 Nov 2016

@ggppdk open any of those isis files and do a Ctrl+F for canOrder and you will see the variable is not being used.

avatar ggppdk
ggppdk - comment - 12 Nov 2016

Yes, exactly, i have seen,

i suggested that we do add usage of it, to prevent the adding of the drag and drop JS

avatar mbabker
mbabker - comment - 12 Nov 2016

So do it as a separate pull request. We have really got to stop making "super" pull requests fixing a bunch of stuff because one pull request exposed something else.

avatar andrepereiradasilva
andrepereiradasilva - comment - 12 Nov 2016

ehhehe agree ... i have been "victim" of some pull requests that exposed a lot of problems

avatar ggppdk
ggppdk - comment - 12 Nov 2016

@mbabker
you are right,
just it seemed relevant / appropriate to add the better checks that i suggested, that also consider the category filter, in this one, but i see your point lets add them in a different PR,

This PR is good in what it tries to do, remove meaningless wrong assets checks, and i will test / review it


I ll make a PR of adding the checks i suggested above, during week, if someone else does not do
Example for com_content, that should work correctly with no changes:

$filter_catid = $this->state->get('filter.category_id');
$canOrder = !$filter_catid ?
    $user->authorise('core.edit.state', 'com_content') :
    $user->authorise('core.edit.state', 'com_content.category.'.$filter_catid);

$saveOrder = $listOrder == 'a.ordering';

if ($canOrder && $saveOrder)
{
    $saveOrderingUrl = 'index.php?option=com_content&task=articles.saveOrderAjax&tmpl=component';
    JHtml::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
}
avatar sanderpotjer sanderpotjer - test_item - 13 Nov 2016 - Tested successfully
avatar sanderpotjer
sanderpotjer - comment - 13 Nov 2016

I have tested this item successfully on be82ddf

@andrepereiradasilva thanks! Tested this and can't find different behaviour after applying the patch.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12867.

avatar csthomas
csthomas - comment - 2 Dec 2016

I have tested this item successfully on be82ddf


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12867.

avatar csthomas csthomas - test_item - 2 Dec 2016 - Tested successfully
avatar jeckodevelopment jeckodevelopment - change - 2 Dec 2016
Status Pending Ready to Commit
avatar jeckodevelopment
jeckodevelopment - comment - 2 Dec 2016

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12867.

avatar zero-24 zero-24 - change - 3 Dec 2016
Milestone Added:
avatar zero-24 zero-24 - change - 3 Dec 2016
Milestone Added:
avatar rdeutz rdeutz - reference | ef99fd0 - 6 Dec 16
avatar rdeutz rdeutz - merge - 6 Dec 2016
avatar rdeutz rdeutz - close - 6 Dec 2016
avatar rdeutz rdeutz - change - 6 Dec 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-12-06 22:07:44
Closed_By rdeutz
avatar rdeutz rdeutz - close - 6 Dec 2016
avatar rdeutz rdeutz - merge - 6 Dec 2016

Add a Comment

Login with GitHub to post a comment