Apart from making the block accessible to logged-in or non-logged-in user, you can also create User Groups with custom conditions and add one or more user groups to block's visibility settings, so that only those groups can access the block. Let's see how User Groups are created.
Creating User Groups
To create a user group, you need to navigate to Settings => User Groups & Permissions => User Groups. The Logged in users groups will always be there by default, and you can use the Add user group button at the bottom to create a new custom group.
Adding a user group
In the pop-up that opens next, you first need to set a name for the group.
Further on, you need to add all the necessary conditions based on which the user will be included in the group. Let's see how that works.
First of all, from the dropdown at the top you should choose whether the user needs to meet any or all of the conditions defined below to be included in the group.
All or any of the conditions
You can add as many conditions as required, and they'll be joined with OR (matchany is selected) or AND (matchall is selected).
"Match any" option selected
Now, let's add a condition using the Add condition button to see how it's configured. There are three fields in Condition Settings, so let's see how each of those works.
First, you need to select the attribute for which you want to set a condition. There are the following options:
We will do a detailed overview of each condition type in the subsections to this article, but now let's complete the user group creation and see how it's assigned to the block.
Creating the Group and Adding In in Block's Visibility
As soon as you've set all the necessary conditions, just hit the Create user group button and the created group will appear in your list of user groups.
Create user group
Now you can use the created group when defining the visibility conditions for a particular block. Navigate to block's visibility settings, select Logged in users, click Add user group, and select the group from the list.
Selecting the user group
That's it. Now, only the users that are part of the selected group will be able to access the block. Please, not that you can add more than one user group to a given block.