User restricted access to content via a common template
I assume you have basic knowledge in creating plugins, if not I suggest visiting the docs.

It's actually pretty easy to achieve your goal.


Create a Plugin and store an array of permission's in it's settings

&lt;!-- first permission --&gt;
&lt;input class="text" type="text" name="permissions[]" value="" autofocus="" autocomplete="off"&gt;

&lt;!-- 2nd permission --&gt;
&lt;input class="text" type="text" name="permissions[]" value="" autofocus="" autocomplete="off"&gt;

&lt;!-- 3rd permission --&gt;
&lt;input class="text" type="text" name="permissions[]" value="" autofocus="" autocomplete="off"&gt;

&lt;!-- 4th permission --&gt;
&lt;input class="text" type="text" name="permissions[]" value="" autofocus="" autocomplete="off"&gt;

&lt;!-- just include some javascript logic to add fields if needed to create them dynamically --&gt;

Register those permission from your plugin

public function registerUserPermissions()
{
    $permissions = array();
    foreach($this-&gt;getSettings()['permissions'] as $rule){
        $permissions[$rule] = array('label' =&gt; $rule);
    }

    return $permissions;
}

Create a custom fieldType that displays all usergroups dynamically or (for testing) create a simple dropdown field that stores user groups

Add this field to a matrix element -> you can store a required group for each element
Go to your usergroups and add the permissions to those groups then you can check if the currentuser is in the group you selected in your dropdown
After you understood the process you can create a custom field type to store/link usergroups (so you can store multiple and select them based on all existing usergroups dynamically)
Make your plugin settings more complex.. in my example you can only store the handle not the label of your permission so if you type "Permission to do that" instead of "permissionToDoSomething" it will break