I’m new to Kirby; couple of week of using it and it’s great
I’m building a site which has different front end user(client) restricted areas. I’ve set up restricted areas with user roles, no problem. So user ‘client’ has access …
<?php if (($user = $kirby->user()) && $user->role()->id() === 'client'): ?>
This visible for clients with the role client.
<?php endif ?>
I’m probably missing something obvious. Is there any way of extending the role ‘client’ with, for example, tags? So the user ‘client’ can be allocated access to different restricted areas depending on their tag?
So, User1 with the role ‘client’ has a tag ‘area1’ and can have access to area1. User2 also has the role ‘client’ and has tags ‘area1’ and ‘area2’ so can have access to ‘area1’ and ‘area2’.
Then at a later date, User1 could also be given the tag ‘area2’
Yes, you can do that by assigning fields to users in your client blueprint where you can set such tags. I assume you have a setup where users cannot change their own settings? Then this should work well and you would only have to extend your if statements.