Answers.Body: <p>One option is to do this:</p>
  
  <pre><code>{% if currentUser.admin ?? false %}
  
      ...this code can only be seen by admins...
  
  {% endif %}
  </code></pre>
  
  <p><code>currentUser</code> is a <a href="https://craftcms.com/docs/templating/global-variables#currentUser" rel="nofollow noreferrer">Global Variable</a> on which you can pass the <code>admin</code> <a href="https://craftcms.com/docs/templating/usermodel#admin" rel="nofollow noreferrer">property</a>. <code>??</code> is a null-coalescing operator which returns <code>false</code> if the <code>currentUser</code> (if there is one) is not an admin.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>So if you want to show this section to anyone logged in to the <code>admin</code> or <code>client</code> account in Craft Client, I'd recommend doing the following:</p>
  
  <pre><code>{% if currentUser ?? false %}
  
      ...this code can only be seen by admins...
  
  {% endif %}
  </code></pre>
  
  <p>Basically, this says if the current user is logged in, display the contents. Since the only ones with logins are you and the client, this will only display the content to you!</p>
  
  <hr>
  
  <p>If you'd like for the whole page to only display for certain users (for any unaccepted visitors it will throw a Craft 403 error page), you can add something like this to the top of your template:</p>
  
  <pre><code>{% requirePermission "permissionHandle" %}
  </code></pre>
  
  <p><em>(You can find a full list of permissions <a href="https://craftcms.com/docs/templating/requirepermission" rel="nofollow noreferrer">here</a>.)</em></p>
  
  <p>I'd recommend the <code>accessCp</code> permission handle if you're wanting to block everyone but the client and admin accounts for Craft Client.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-13T21:35:25.623Z
Answers.Text: Thanks for your answer! 
  i will check your solution, and i´m checking right now with requirePermission
  https://craftcms.com/docs/templating/requirepermission
Answers.UserDisplayName: Sebastian
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-13T21:38:00.327Z
Answers.Text: `{% requirePermission %}` could possibly do the trick for you, yes, but you'd be allowing access based on whether they have some specific permission vs if they are admins or not. Which isn't a bad thing but just wanted to clarify the difference...
Answers.UserDisplayName: Jalen Davenport
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-13T21:43:09.183Z
Answers.Text: I´m using Craft client license, so i have admin account and client account only. Admin account and client account should have both access. With this in mind, what option whould you recommend? 
  I set `{% requirePermission "accessCp" %}` as the needed permission, since both account have access to cp.
Answers.UserDisplayName: Sebastian
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-13T21:48:46.823Z
Answers.Text: @Sebastian I updated my answer, check it out ^
Answers.UserDisplayName: Jalen Davenport
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-13T21:51:44.567Z
Answers.Text: Actually, just looked into the `{% requirePermission %}` stuff again. I would not recommend using it because it will throw a 403 error for anyone that doesn't meet the necessary requirements. So anyone that hits that page that isn't logged in will be greeted with a pretty 403 error - which I'm assuming is not what you want. So yeah, the `{% if currentUser ?? false %}` is probably your best bet...
Answers.UserDisplayName: Jalen Davenport
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-13T21:59:34.123Z
Answers.Text: Yes, but the error page it´s not a problem in this case, because the url to access it´s not available to public.
  I see your solution works great for pieces of content too, like displaying some areas for users only. The `{% requirePermission %}` blocks the whole thing :)
Answers.UserDisplayName: Sebastian
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-13T22:02:06.120Z
Answers.Text: Gotcha gotcha... Let me update my answer with that tidbit to make it more helpful for anyone reading it later.
Answers.UserDisplayName: Jalen Davenport
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-13T21:33:32.303Z
Answers.LastActivityDate: 2018-03-13T22:11:11.713Z
Answers.LastEditDate: 2018-03-13T22:11:11.713Z
Answers.UserDisplayName: Jalen Davenport
Body: <p>I know this is a basic question, but i never use Craft this way.</p>
  
  <p>I need to show a section ( list of items ) in the frontend but only available for admin users ( that are already logged in the control panel ). </p>
  
  <p>How can achieve this restriction from the template?</p>
  
  <p>Thanks!</p>
  
Tags: <users><frontend><craft-features>
Title: How to restrict access to some section in front-end for admin user only?
ThreadText: # How to restrict access to some section in front-end for admin user only?
  
  (Asked by: username_0 on 2018-03-13)
  
  I know this is a basic question, but i never use Craft this way.
  
  I need to show a section ( list of items ) in the frontend but only available for admin users ( that are already logged in the control panel ).
  
  How can achieve this restriction from the template?
  
  Thanks!
  
  **Tags:** users, frontend, craft-features
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-03-13. Score: 1 | Accepted answer
  
  One option is to do this:
  
  ```
  {% if currentUser.admin ?? false %}
  
      ...this code can only be seen by admins...
  
  {% endif %}
  
  ```
  
  `currentUser` is a [Global Variable](https://craftcms.com/docs/templating/global-variables#currentUser) on which you can pass the `admin` [property](https://craftcms.com/docs/templating/usermodel#admin). `??` is a null-coalescing operator which returns `false` if the `currentUser` (if there is one) is not an admin.
  
  **Edit:**
  
  So if you want to show this section to anyone logged in to the `admin` or `client` account in Craft Client, I'd recommend doing the following:
  
  ```
  {% if currentUser ?? false %}
  
      ...this code can only be seen by admins...
  
  {% endif %}
  
  ```
  
  Basically, this says if the current user is logged in, display the contents. Since the only ones with logins are you and the client, this will only display the content to you!
  
  ---
  
  If you'd like for the whole page to only display for certain users (for any unaccepted visitors it will throw a Craft 403 error page), you can add something like this to the top of your template:
  
  ```
  {% requirePermission "permissionHandle" %}
  
  ```
  
  *(You can find a full list of permissions [here](https://craftcms.com/docs/templating/requirepermission).)*
  
  I'd recommend the `accessCp` permission handle if you're wanting to block everyone but the client and admin accounts for Craft Client.
  
  > **Comments:**
  > **username_0**: Thanks for your answer!  i will check your solution, and i´m checking right now with requirePermission https://craftcms.com/docs/templating/requirepermission  
  > **username_1**: `{% requirePermission %}` could possibly do the trick for you, yes, but you'd be allowing access based on whether they have some specific permission vs if they are admins or not. Which isn't a bad thing but just wanted to clarify the difference...  
  > **username_0**: I´m using Craft client license, so i have admin account and client account only. Admin account and client account should have both access. With this in mind, what option whould you recommend?  I set `{% requirePermission "accessCp" %}` as the needed permission, since both account have access to cp.  
  > **username_1**: @username_0 I updated my answer, check it out ^  
  > **username_1**: Actually, just looked into the `{% requirePermission %}` stuff again. I would not recommend using it because it will throw a 403 error for anyone that doesn't meet the necessary requirements. So anyone that hits that page that isn't logged in will be greeted with a pretty 403 error - which I'm assuming is not what you want. So yeah, the `{% if currentUser ?? false %}` is probably your best bet...  
  > **username_0**: Yes, but the error page it´s not a problem in this case, because the url to access it´s not available to public. I see your solution works great for pieces of content too, like displaying some areas for users only. The `{% requirePermission %}` blocks the whole thing :)  
  > **username_1**: Gotcha gotcha... Let me update my answer with that tidbit to make it more helpful for anyone reading it later.  
  
  ---
  
  