Catalogue perms

Post

Posted
Rating:
#5272 (In Topic #1063)
Joe
I have a database of things inside a catalogue category. I am aware of being able to restrict usergroup access to the category itself, but I was hoping to restrict access to specific entries depending on the USERGROUP (I want to grant complete access to the category though). Currently, the only permission levels to select from restricting access to individual entries are: everyone, members only, friends only, myself only.

Is there a work-around for this?

Post

Posted
Rating:
#5273
Joe
If there isn't a simpler way, I thought about just creating a custom field (multiple values chosen from a list) that would enable me to select which groups could view, then modify the catalogue template to check if the user is in a permissible group.

But I'm wondering if there would be any performance disadvantages to doing it that way? Plus I'd have to hard-code the usergroups in the custom field…it'd be a dirty workaround.

Post

Posted
Rating:
#5277
You'll have to do some kind of workaround, as I don't we'll be supporting that anytime in the future for performance and UI overhead reasons.

One possibility, are you able to enable "Narrow-in when browsing" for catalogues? That way you can put things in subcategories, and have them display in the parent category according to the permissions on the subcategory.
I think this is a global setting that affects all categories, so that may be an issue, but it may be you can search the code for where this setting is applied and alter it a bit – maybe it could even be made to only run on certain category views.

Otherwise I think some kind of Tempcode workaround would be needed. I don't think it would hurt performance much. You could make a field that was interpreted as Selectcode, then use the IS_IN_GROUP against it.

Something like:

Code

{+START,IF,{$OR,{$IS_EMPTY,{FIELD_17}},{$IS_IN_GROUP,{FIELD_17}}}}
...
{+END}

Where the inputted value is something like 1-8,9-13

Or you could introduce a level of indirection…

Code

{+START,IF,{$OR,{$IS_EMPTY,{FIELD_17}},{$AND,{$EQ,{FIELD_17},free_users},{$IS_IN_GROUP,1-8,9-13}},{$AND,{$EQ,{FIELD_17},free_trial_users},{$IS_IN_GROUP,14,15}}}}
...
{+END}

Where the inputted value is a value like free_users.

(I didn't test any of the above code)
0 guests and 0 members have recently viewed this.