Skip to main content

Add and Assign a Role

Last updated 7/06/2024

This documentation will demonstrate a basic method to adding a role in Five. No menu will be assigned or any security table applied to the role it is purely to show how to add a role with permissions and then assign this role to a user to secure your application.

Scenario

A small Products application where each customer can see their products has been setup to demonstrate the different methods you can use to add your roles.

Tables

A three table database is established that holds the Customer, Product, and iUser tables. The iUser table is injected by Five into your database when you create a multiuser application. This enables you to add users into your application immediately. To create a multiuser application the Multiuser switch on the Application form needs to be turned on.

Effectively, Five enforces security of your application through the permissions assigned to the role that is attached to the user.


Database model
Figure 1 - Database model

Form and Menu Setup

In the application, a Customer form sits at the top-level and from here you can drill down to purchase a product. To have the drill down functionality, the Customers menu is the parent for the Products menu.

The image below shows when signed in as admin, all the customers are visible in the list, selecting one and clicking the Down button will show their products.


Customer products
Figure 2 - Customer products

Add a Role

tip
Creating a role for a user of your application must be done in Five!

1. Navigate to the Roles view by selecting Setup in the Menu and Roles in the sub-menu.


Roles menu item
Figure 3 - Roles menu item

2. Click the Add Item button and give your role a name.


Add a role
Figure 4 - Add a role

3. Click the Permissions tab.


Permissions tab
Figure 5 - Permissions tab

4. Click the Add Permissions button.


Add Permissions button
Figure 6 - Add Permissions button

5. Select a data source in the Data Source Field.

6. Grant the permissions to this data source by clicking the appropriate checkboxes.


Add permissions
Figure 7 - Add permissions

7. Click the Save button in the form app bar.


Save button
Figure 8 - Save button

8. Click the Save button in the form app bar above the list.


Save button
Figure 9 - Save button

Assign a Role

Tips
  • Assigning a role to a user of your application must be done in your application!
  • Five's default admin user enables you to add users to your application!

1. Sign into your application.

2. Select the Users menu item.

3. Click the Add Item button and add a User ID for your user.

info
This will be their username when logging into your application, except if it is flagged to use their email on the Instance record.

Add a user
Figure 10 - Add a user

4. Add your user's full name, email and their password. Optionally, you can add their phone number.

5. Select the role you want to assign them in the Role field.


User record
Figure 11 - User record

6. Click the Save button in the form app bar.


Save button
Figure 12 - Save button

User Login

Your user will log into your application using the user ID and password that you added on their user record. When this user logs in, they will only have the permissions to the data sources that you allowed.


User login
Figure 13 - User login