Answers.Body: <p>I’ve figured out what I was missing. I needed to use <a href="https://docs.craftcms.com/v3/dev/element-queries/user-queries.html#can" rel="nofollow noreferrer">can</a>: </p>
  
  <p><code>{% if currentUser.can('accessCp') ?? false %}</code></p>
  
  <p>:)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-18T15:35:16.333Z
Answers.LastActivityDate: 2019-06-18T15:35:16.333Z
Answers.UserDisplayName: Jonathan Schofield
Body: <p>I know I can restrict template output to Admins only with : </p>
  
  <p><code>{% if currentUser.admin ?? false %}</code></p>
  
  <p>…and to <em>any</em> logged in user with:</p>
  
  <p><code>{% if currentUser ?? false %}</code></p>
  
  <p>And I’m aware of <code>accessCp</code> as a <a href="https://docs.craftcms.com/v3/users.html#permissions" rel="nofollow noreferrer">permissions handle</a>.</p>
  
  <p>Can I use that, or similar, to restrict template output to any user group that is allowed to access the CP – <em>without</em> having to cycle through specific user groups in the template?</p>
  
  <p>I tried: </p>
  
  <p><code>{% if currentUser.accessCp ?? false %}</code></p>
  
  <p>…but that doesn't work.</p>
  
  <p>I'm using Craft 3.1.29.</p>
  
Tags: <templating><permissions><user-groups>
Title: Restricting access to user groups with Control Panel access only
ThreadText: # Restricting access to user groups with Control Panel access only
  
  (Asked by: username_0 on 2019-06-18)
  
  I know I can restrict template output to Admins only with :
  
  `{% if currentUser.admin ?? false %}`
  
  …and to *any* logged in user with:
  
  `{% if currentUser ?? false %}`
  
  And I’m aware of `accessCp` as a [permissions handle](https://docs.craftcms.com/v3/users.html#permissions).
  
  Can I use that, or similar, to restrict template output to any user group that is allowed to access the CP – *without* having to cycle through specific user groups in the template?
  
  I tried:
  
  `{% if currentUser.accessCp ?? false %}`
  
  …but that doesn't work.
  
  I'm using Craft 3.1.29.
  
  **Tags:** templating, permissions, user-groups
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-06-18. Score: 2
  
  I’ve figured out what I was missing. I needed to use [can](https://docs.craftcms.com/v3/dev/element-queries/user-queries.html#can):
  
  `{% if currentUser.can('accessCp') ?? false %}`
  
  :)
  
  
  ---
  
  