Skip to content

Setting up admin panel

This guide will help you setup your admin panel for the first time. Follow this guide after installing the starterkit and running the docker command.

User registration

For user registration to work, you have to complete the following steps:

  • When getting started, you have to give the public role the ability to Create directus_users collection. To do that, go to your admin panel > Settings > User Roles > Public. Click on the public policy and Add the "directus_users" Collection. Click on the "Create" button to give full access to the public role. Click on Save and Save again.
    This will give the public role the ability to create users.

  • Also you need to create a new role for authenticated users. You can name this role anything you want. For example, "Authenticated Users". Create a new policy for the role. The policy should look like the following.

    user permissions

    posts

    • posts > Create > Use Custom > user_created equals $CURRENT_USER
    • Give full field permissions

    user create permissions

    • Do the same for posts > Read

    directus_files

    • Give full access for Create.
    • For read, click on Use Custom > Item Permissions > uploaded_by equals $CURRENT_USER (give full Field Permissions). This is to only allow the uploader of the files to access their files. If you want to let the files to be viewable by every user. You have to use full read access.
    • For delete, click on Use Custom > Item Permissions > uploaded_by equals $CURRENT_USER

    directus_users

    • For read, click on Use Custom > Item Permissions > id equals $CURRENT_USER (give access to full fields). for most applications, you only have to allow the logged in user to see their details.
    • For update, click on Use Custom > Item Permissions > id equals $CURRENT_USER. For field permissions, only give access to the fields that the users should be able to update like avatar, first_name, last_name.
  • Go to your admin panel > Settings > Settings, scroll down to the "User Registration" section and enable the "User Registration" route. This will enable user registration on your app. In the same settings, you can set the user role to the role you created for authenticated users.

Subscribed users

For managing the permissions of the subscribed users, you can create new roles for each subscription plan. Give the authenticated user role as the parent role and add additional permissions for each subscription plans.

Add the role id of each subscription plans in the app.config.ts file under the role key. so that users will be given this role when they subscribe.

How to restrict limits on subscription plans?

The limitations on each subscription plan is currently done using the flows in admin panel. This makes it easier to manage the limits unlike other starterkits. Edit the flow to your needs. Add your subscription user role id in the flow.

Add static token in to your nuxt app

Go to your admin panel > Users > Admin > Generate Token. Copy the static token and paste it in the .env file of your nuxt app.