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
The problem is,
as well as add a template modification to add additional
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:
Fillip
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]
));
<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>
Fillip
Upvote
0