? Success

User tests: Successful: Unsuccessful:

avatar andrepereiradasilva
andrepereiradasilva
9 Nov 2016

Pull Request for Issue #12785.

Summary of Changes

This PR:

  • solves the issue #12785
  • as discussed in #12809, also reverts the B/C issues introduced by #12028
  • does performance and memory usage otimizations. Now almost (if not all) rules check will use the preloading method (fallback to direct bd check preserved).
  • fallback when the asset for the item is not found and also adds a log message to better debug bad ACL rules check.

Performance & Memory Improvements

Comparing to 3.6.4 there is an overall improve in performance (vary), reduced BD queries (around less 5 to 8 queries) and memory usage (around less 0.5MB) in all pages (some less, some more).

Some tests (click arrow for details and images):

Test: Frontend page logged in as Administrator

Before PR (3.6.4)

image

After PR

image

Test: Frontend page not logged

Before PR (3.6.4)

image

After PR

image

Test: Backend list view 100 articles logged in as Administrator

Before PR (3.6.4)

image

After PR

image

Test: Backend list view 500 articles logged in as Administrator

Before PR (3.6.4)

image

After PR

image


Test notes: The total page generation time an db queries time, since it depends on several factors is not accurate. Made with PHP 7.0 without opcache.

B/C

Should be B/C. But confirmation is needed.

Testing Instructions

The ACL system needs to be tested as a whole.

Please test with caution. This is not a fast test.

First you need to do a code review and with that check for potential B/C issues.

Then you need to test asset inheritence: Global config -> Component [-> Categories] -> Item and also user group inheritence.

Some examples (asset inheritence: Global config -> Component [-> Categories] -> Item):

  • In global config child groups should inherit from their parent
  • Simple component (without categories, ex: com_modules):
    • component permissions must inherit from global config.
    • item must inherit from component permissions.
  • More complex component (with categories, ex: com_content):
    • component permissions must inherit from global config.
    • root categories permissions must inherit from component permissions.
    • child categories permissions must inherit from parent categories permissions.
    • item must inherit from his category permissions.

Note: In all the cases above you need to also check user group inheritence.

Finnaly, you need to do some other tests like this:

  • When a asset for a item does not exist in the #__assets table it should fallback to the component asset or to root asset (in case of a component).
  • Super user must access everything
  • No user without super right permission can be a super user
  • any other ACL checks you main remember

Documentation Changes Required

None.

avatar andrepereiradasilva andrepereiradasilva - open - 9 Nov 2016
avatar andrepereiradasilva andrepereiradasilva - change - 9 Nov 2016
Status New Pending
avatar andrepereiradasilva andrepereiradasilva - change - 9 Nov 2016
Labels Added: ?
avatar andrepereiradasilva andrepereiradasilva - edited - 9 Nov 2016
avatar joomla-cms-bot joomla-cms-bot - change - 9 Nov 2016
Category Libraries
avatar andrepereiradasilva andrepereiradasilva - change - 9 Nov 2016
The description was changed
avatar andrepereiradasilva andrepereiradasilva - edited - 9 Nov 2016
avatar andrepereiradasilva andrepereiradasilva - change - 9 Nov 2016
The description was changed
avatar andrepereiradasilva andrepereiradasilva - edited - 9 Nov 2016
avatar andrepereiradasilva andrepereiradasilva - edited - 9 Nov 2016
avatar andrepereiradasilva andrepereiradasilva - change - 9 Nov 2016
The description was changed
avatar andrepereiradasilva andrepereiradasilva - edited - 9 Nov 2016
avatar andrepereiradasilva andrepereiradasilva - edited - 9 Nov 2016
avatar andrepereiradasilva andrepereiradasilva - change - 9 Nov 2016
The description was changed
avatar andrepereiradasilva andrepereiradasilva - edited - 9 Nov 2016
avatar andrepereiradasilva andrepereiradasilva - change - 9 Nov 2016
The description was changed
avatar andrepereiradasilva andrepereiradasilva - edited - 9 Nov 2016
8ab311d 9 Nov 2016 avatar andrepereiradasilva cs
avatar andrepereiradasilva andrepereiradasilva - edited - 9 Nov 2016
avatar andrepereiradasilva andrepereiradasilva - change - 9 Nov 2016
The description was changed
avatar andrepereiradasilva
andrepereiradasilva - comment - 9 Nov 2016

@nikosdion @phproberto @ggppdk can you review this and check if there are no B/C issues now (and the introduced B/C issues in https://github.com/joomla/joomla-cms/pull/12028/files are now reverted).

avatar andrepereiradasilva
andrepereiradasilva - comment - 12 Nov 2016

mantainers can you add a release blocker tag here?

avatar zero-24 zero-24 - change - 12 Nov 2016
Milestone Added:
avatar zero-24 zero-24 - change - 12 Nov 2016
Labels Added: ?
avatar nikosdion
nikosdion - comment - 13 Nov 2016

While this is not breaking b/c with Joomla 3.6.4 as far as I can see (more eyeballs on the code will be appreciated) I did spot that you have renamed a lot of method parameters (without changing their intent). Changing the parameter signature will cause code extending this class to emit notices. In fact a 3PD cannot solve that unless they create two different classes for each version of Joomla, causing either code duplication or inelegant code structure. It is therefore unadvisable to change the parameter names in a minor release.

I'd be happy with this PR if the original parameter names were preserved, e.g. retain public static function check($userId, $action, $asset = null, $preload = true) instead of public static function check($userId, $action, $assetKey = null, $preload = true). I understand that the parameter name $assetKey is better than $asset but we shouldn't touch that until 4.0 where there's a reasonable expectation of breaking b/c anyway.

(Edit: in case it wasn't very obvious from what I said: Good job!)

avatar ggppdk
ggppdk - comment - 13 Nov 2016

In fact a 3PD cannot solve that unless they create two different classes for each version of Joomla, causing either code duplication or inelegant code structure. It is therefore unadvisable to change the parameter names in a minor release.

Correct, but i think you meant to speak of type declaration (type hint) of the function's arguments
and in this case there is no type declaration for them

About
-- method's parameter names
-- and their default values too
I think, it is allowed to change both (or is it not allowed in some specific PHP version ?)

e.g. the following example, changes both function's argument names and their default values too
and it works without warnings or errors

class base_class
{
    function some_func($word=null)
    {
        return 'i am base: ' . $word;
    }
}

class extended_class extends base_class
{
    function some_func($text='hello')
    {
        return 'i am extended: '. $text;
    }
}

$test = new extended_class();
echo $test->some_func();
avatar nikosdion
nikosdion - comment - 13 Nov 2016

I believe in PHP 7 it does throw a notice? I can't check right now. Can you please do that?

avatar ggppdk
ggppdk - comment - 13 Nov 2016

I believe in PHP 7 it does throw a notice? I can't check right now. Can you please do that?

Ok, i have tested in PHP 7,
it does not throw any notices / warning with error_reporting to maximum or development

2 days ago i had the same thought and made similar comment for another PR

but after testing it seems that both renaming parameters and changing default values,
are both allowed in PHP 7 too, without any notices or warnings

avatar nikosdion
nikosdion - comment - 13 Nov 2016

Ah, good! I stand corrected. In this case I have no objections to this PR.

avatar andrepereiradasilva
andrepereiradasilva - comment - 13 Nov 2016

(Edit: in case it wasn't very obvious from what I said: Good job!)

Thanks!

So for what i understand, from your review you think there are no B/C issues. it would be good if someone else check that too, more eyes is always better.

Is also needed two tests in the behaviour itself to check all works fine.
@Fedik sorry to ask you again this, but can you test this new one?

avatar Fedik
Fedik - comment - 13 Nov 2016

@andrepereiradasilva no problem, it already was in my "to do" ?

avatar Fedik
Fedik - comment - 13 Nov 2016

I have tested this item successfully on 7b6b707


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

avatar Fedik Fedik - test_item - 13 Nov 2016 - Tested successfully
avatar ggppdk
ggppdk - comment - 18 Nov 2016

I have tested this item successfully on 7b6b707


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

avatar ggppdk ggppdk - test_item - 18 Nov 2016 - Tested successfully
avatar zero-24 zero-24 - change - 19 Nov 2016
Status Pending Ready to Commit
Labels Added: ?
avatar rdeutz rdeutz - reference | a6a0a96 - 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:03
Closed_By rdeutz
Labels Removed: ?
avatar rdeutz rdeutz - close - 6 Dec 2016
avatar rdeutz rdeutz - merge - 6 Dec 2016

Add a Comment

Login with GitHub to post a comment