I'm trying to restrict access to items in a channel using some form of custom user permissions however I don't appear to be able to create or set custom read permissions for a channel using crafts permissions as they currently are, I'm therefore trying to do something using either user groups or custom fields on the user and validate if a user has access that way.
I'm hoping this is along the right lines, although it doesn't seem ideal, so is it possible to check if a user is in a certain user group elegantly using twig?
I can do {{ if currentUser.admin }} and I'm guessing I could therefore do something like {{if 'groupnamewithaccess' in currentUser.groups }}
{% if !currentUser.isInGroup('groupHandle') %}
– David A McInnis Sep 23 '14 at 22:48{% if not currentUser.isInGroup('groupHandle') %}– Brad Bell Sep 24 '14 at 03:14craft()->userGroups->getGroupsByUserId($user->id)– Elliot Cameron Apr 25 '17 at 04:29currentUser.isInGroup(['groupHandle1','groupHandle2'])for an OR, which is pretty neat. – iamkeir Nov 06 '19 at 14:38