Lack of interest [Developer Tool] Improve "Analyze permissions" back-end to allow for easier inheritance

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

DragonByte Tech

Well-known member
Recently, I took it upon myself to write a system for permission inheritance for the new FlatContentPermissions / AbstractFlatPermissions system, in order to allow for eCommerce products to inherit permissions from categories as well as from the global scope.
This was very easy to do; all I had to do was implement a custom getApplicablePermissionSets in my permission definition file, which defined new entries in the $sets array for categories (f.ex. $sets["ecommerce-category-group-$userGroupId"] etc).

The problem is, analyzeCombination and the permission_analyze templates are hardcoded to only accept the built-in sets. I had to copy the entire analyzeCombination function just to add
PHP:
        $thisIntermediates = array_merge($thisIntermediates, $this->collectCategoryIntermediates(
            $combination, $permissions, $sets, $contentId, $titles[$contentId]
        ));
as well as add a template modification to add additional <xf:if> checks for the new intermediaries.

I believe that with a few changes, this can be made less involved for developers. Off the top of my head, I can think of a small list of changes:
  • Change analyzeCombination to add support for an optional $this->collectIntermediaries method (is_callable check?) in a similar way to my code above
  • Add an optional 6th parameter to AnalysisIntermediate that contains the phrase text used for this intermediary
  • Add a new elseif chain at the end of the intermediate loop in the template, something like
    HTML:
    <xf:else />
        <xf:if is="$intermediate.contentId">
            {$intermediate.contentTitle} - {{ $intermediate.typePhrase ?: phrase('n_a') }}
        <xf:else />
            {{ $intermediate.typePhrase ?: phrase('n_a') }}
        </xf:if>
    </xf:if>
I can actually create this system and test it for you if this is something you would be interested in? :)


Fillip
 
Upvote 0
This suggestion has been closed. Votes are no longer accepted.
Top Bottom