Ok, looks like you're wanting to stop the authorization check done by CB Privacy if the viewing user has a usergroup that matches cb_id_groupe_acl_premium. To do this make a copy of "CB Gallery - Privacy - Authorized" in CB Auto Actions > System Actions and then unpublish the "CB Gallery - Privacy - Authorized" system action. Now publish your copy of the system action. This effectively replaces the system action with your own. Next add the following AND condition (use the "Add AND Rows" button).
Field: Custom > Code
Code:
Code:
$loopUser = CBuser::getUserDataInstance( (int) '[loop_user_id]' );
$loopACL = $loopUser->get( 'cb_id_groupe_acl_premium', 0, \CBLib\Registry\GetterInterface::INT );
return ( $loopACL ? ( in_array( $loopACL, \CBLib\Application\Application::MyUser()->getAuthorisedGroups() ) ? 'SKIP' : 'CHECK' ) : 'CHECK' );
Operator: Not Equal To
Value: SKIP
We have to use PHP for this because we can't nest a complicated substitution inside of a substitution. It only allows nesting simple substitutions. So instead we'll use PHP to build a user object from the loop_user_id. We then get that users field value for cb_id_groupe_acl_premium. Next we see if the viewing user has cb_id_groupe_acl_premium in their list of usergroups. If they do it will respond with SKIP and cause the condition to block the auto action from working, which blocks the CB Privacy check from taking place.
Instead of replacing the system action however you could just override the authorized check in CB Privacy with custom behavior. To do this you'd use the below.
Global
Triggers: privacy_onAuthorized
Type: Code
User: Specific
User IDs: [var3_user_id]
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var3_asset]
Operator: Is REGEXP
Value: /^gallery./
Condition 2
Field: Custom > Value
Custom Value: [cb:if user="[var2]" usergroup includes "[cb_id_groupe_acl_premium]"]ALLOWED[/cb:if]
Operator: Equal To
Value: ALLOWED
Action
Method: PHP
Code:
Code:
$variables['var1'] = true;
Parameters
Reference Variables: Variable 1
What the above does is first checks if the privacy rule is being applied to CB Gallery. If it is it checks if the accessing user (their user id is sent in [var2]) has a usergroup matching [cb_id_groupe_acl_premium] for the owner of the privacy rule. If they do then it sets var1 to true, which tells it they're authorized to have access to whatever that privacy rule is protecting. This should be a cleaner approach to avoid having to maintain a copy of a system action.
I assume that in the auto action [user_id] is the "viewer user" and [loop_user_id] the "displayed user"
Correct. The [loop] variable is actually the objects being looped. In this case it's the gallery media objects. So [loop_user_id] is actually just the owner of the gallery media.