Tutorial: Creating a private Developer Portal site

You can create a private version of the Developer Portal, so that authenticated users only can access content on the site. You might want to do this if you want to restrict public access to your content unless they are logged in.

Before you begin

You must have a Developer Portal enabled, and you must have administrator access to complete this tutorial. The tutorial Creating the Portal explains how to enable the portal if you have not already done so.

About this tutorial

In this tutorial, you are going to restrict access for all the content to authenticated users only. This gives access to all users from Content Author to Superuser, as they are all required to authenticate to access their roles. You will then add the login form to the home page, so that public users will be able to view the public home page that contains the login form only.

Export your configuration settings

In case you make an error, or want to revert all of the changes made during this tutorial, you can back up your configuration settings to your machine before you make any changes.

The tutorial Exporting and importing custom themes and site configuration provides further details on how to export your configuration settings using the Developer Portal CLI.

Restrict all permissions to authenticated users

  1. If the administrator dashboard isn’t displayed, click Manage to display it.
  2. Navigate to People > Permissions.
  3. Clear all check boxes that are associated with ANONYMOUS USER.
  4. Click Save permissions at the end of the page.

Restrict blocks to authenticated users

  1. If the administrator dashboard isn’t displayed, click Manage to display it.
  2. Navigate to Structure > Block layout.
  3. Find the row that is labeled Main menu and click Configure.
  4. Find the setting Roles under the category Visibility.
  5. Check the box Authenticated user.
  6. Click Save block.
  7. Repeat from step 3 for the Footer menu.
  8. Click Save block.

Add login form to the home page

  1. If the administrator dashboard isn’t displayed, click Manage to display it.
  2. Navigate to Structure > Pages.
  3. Click Edit on the Welcome page.
  4. Navigate to Panels > Content.
  5. Click Add new block.
  6. Find and click User login, under the FORMS section.
  7. Clear the Display title check box.
  8. Click Add block.
  9. Rearrange the new login block so that it is underneath the Welcome Banner.
  10. Click Update and save.

What you did in this tutorial

On your Developer Portal, you restricted access for all the content to authenticated users only. Now when you access your home page as an unauthenticated user, you see that the login form appears underneath the welcome banner. Navigating to other URLs on the site presents an unauthorized page to appear.

When you log in, the login form disappears from the home page and you are able to access all of the pages that are visible to your role.