Answers.Body: <p>If you want to restrict an entire template, something like the following should work.</p>
  
  <pre><code>{% set authorized = false %}
  {% if currentUser %}
      {% if currentUser.isInGroup('employee') %}
          {% set authorized = true %}
      {% endif %}
  {% endif %}
  
  {% if not authorized %}
      {% redirect 401 %}
  {% endif %}
  
  {# display template #}
  </code></pre>
  
  <p>Note: You can redirect anywhere with the <code>redirect</code> tag. I just used 401 as an example. </p>
  
  <p>If you want to designate whether specific entries are viewable then you might want to set a custom field — something like a 'lightbox' field with the handle 'public' for example.</p>
  
  <pre><code>{% set authorized = false %}
  {% if currentUser %}
      {% if currentUser.isInGroup('employee') %}
          {% set authorized = true %}
      {% endif %}
  {% endif %}
  
  {% if authorized %}
      {# show non-public positions #}
      {% set positions = craft.entries.section('jobPostings').public('0') %}
      &lt;h2&gt;In-house Job Openings&lt;/h2&gt;
      &lt;ul&gt;
          {% for position in positions %}
              &lt;li&gt;&lt;a href="{{ position.url }}"&gt;{{ position.title }}&lt;/a&gt;&lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  {% endif %}
  
  {# show public positions #}
  &lt;h2&gt;Public Job Openings&lt;/h2&gt;
  {% set positions = craft.entries.section('jobPostings').public('1') %}
  &lt;ul&gt;
      {% for position in positions %}
          &lt;li&gt;&lt;a href="{{ position.url }}"&gt;{{ position.title }}&lt;/a&gt;&lt;/li&gt;
      {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>Then on the detail page (if there is a detail page), do the same:</p>
  
  <pre><code>{% set authorized = false %}
  {% if currentUser %}
      {% if currentUser.isInGroup('employee') %}
          {% set authorized = true %}
      {% endif %}
  {% endif %}
  
  {% if not entry.public and not authorized %}
      {% redirect 401 %}
  {% endif %}
  
  {# otherwise display entry #}
  </code></pre>
  
  <p>See <a href="https://craftcms.stackexchange.com/questions/6554/protect-entry-so-that-only-a-relatedto-user-can-see-it/6555#6555">this answer</a> and <a href="https://craftcms.stackexchange.com/questions/4182/password-protected-area-with-unique-files/4184#4184">this answer</a> for more options.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-28T21:19:58.600Z
Answers.LastActivityDate: 2015-01-28T21:44:01.033Z
Answers.LastEditDate: 2017-04-13T12:51:00.253Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>Is there a way to build a protected webpage within craft. Something that can only be accessed if you have the actual link. Something that you can not click to through the website. The point is to have a webpage that only the employees can access. Thanks for the help!!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-01-28T21:02:05.277Z
Comments.Text: @DouglasMcDonald Thanks for your help. Trying to post open positions in-house before they are open to the public.
Comments.UserDisplayName: Dillon van der Wal
Tags: <security>
Title: Protected Web Page
ThreadText: # Protected Web Page
  
  (Asked by: username_0 on 2015-01-28)
  
  Is there a way to build a protected webpage within craft. Something that can only be accessed if you have the actual link. Something that you can not click to through the website. The point is to have a webpage that only the employees can access. Thanks for the help!!
  
  **Tags:** security
  
  > **Comments:**
  > **username_0**: @username_1 Thanks for your help. Trying to post open positions in-house before they are open to the public.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-01-28. Score: 2
  
  If you want to restrict an entire template, something like the following should work.
  
  ```
  {% set authorized = false %}
  {% if currentUser %}
      {% if currentUser.isInGroup('employee') %}
          {% set authorized = true %}
      {% endif %}
  {% endif %}
  
  {% if not authorized %}
      {% redirect 401 %}
  {% endif %}
  
  {# display template #}
  
  ```
  
  Note: You can redirect anywhere with the `redirect` tag. I just used 401 as an example.
  
  If you want to designate whether specific entries are viewable then you might want to set a custom field — something like a 'lightbox' field with the handle 'public' for example.
  
  ```
  {% set authorized = false %}
  {% if currentUser %}
      {% if currentUser.isInGroup('employee') %}
          {% set authorized = true %}
      {% endif %}
  {% endif %}
  
  {% if authorized %}
      {# show non-public positions #}
      {% set positions = craft.entries.section('jobPostings').public('0') %}
      <h2>In-house Job Openings</h2>
      <ul>
          {% for position in positions %}
              <li><a href="{{ position.url }}">{{ position.title }}</a></li>
          {% endfor %}
      </ul>
  {% endif %}
  
  {# show public positions #}
  <h2>Public Job Openings</h2>
  {% set positions = craft.entries.section('jobPostings').public('1') %}
  <ul>
      {% for position in positions %}
          <li><a href="{{ position.url }}">{{ position.title }}</a></li>
      {% endfor %}
  </ul>
  
  ```
  
  Then on the detail page (if there is a detail page), do the same:
  
  ```
  {% set authorized = false %}
  {% if currentUser %}
      {% if currentUser.isInGroup('employee') %}
          {% set authorized = true %}
      {% endif %}
  {% endif %}
  
  {% if not entry.public and not authorized %}
      {% redirect 401 %}
  {% endif %}
  
  {# otherwise display entry #}
  
  ```
  
  See [this answer](https://craftcms.stackexchange.com/questions/6554/protect-entry-so-that-only-a-relatedto-user-can-see-it/6555#6555) and [this answer](https://craftcms.stackexchange.com/questions/4182/password-protected-area-with-unique-files/4184#4184) for more options.
  
  
  ---
  
  