About Users

This article aims to provide you with comprehensive information on implementing users in your Knack app and effectively managing them.

In order to assist you in quickly finding the information you require, this article covers the following topics:

 

What are users?

Knack offers user and login functionality, allowing you to enforce login requirements for your live app users, establish roles and permissions, and restrict access for logged-in users to their own records.

By default, any Knack app is accessible to anyone with the URL. However, by enabling users and logins, users will now be required to log in before they can access the app.

If a login is added, the app will appear as follows:

To gain access to the app, an email and password are now necessary. Individuals who possess an email and password to log in and utilize the app are referred to as users.

 

Activating Users 

To activate user and login features, select the User Logins section while viewing the App Settings from the left side menu. In the User Logins section, select the "Activate Users" button. 

aboutusers1

Note: You can also activate users by selecting "Enable Users" under the User Roles section of your Tables list.

aboutusers2

While activating users from the app settings, you will have the option to choose which type of login you want to use with your app:

  • Secure individual pages with a login will allow you to have different types of users and choose which pages will have logins. (This is the preferred option.)

  • Secure every page with the same login will only allow you to add one login to your app for only one type of user. (Less flexible)

  • Do not require a login to access your application will allow anyone with the URL to access your app. (This is not recommended. You can remove login pages individually to create public access.)

Caution: Login settings are foundational to your app’s structure. Changing this selection after you have set up pages with logins will cause unrecoverable breaking changes.

If you want to test out a different setting, please do so in an app copy.

aboutusers3

Tip: Most app use cases require user roles such as Employees, Supervisors, Teachers, and Students. To allow different roles to access different parts of your app, it is important to select the default option which enables logins for different pages and user roles.
You can learn more on managing user and login features and security settings available after user logins have been enabled.
 

Managing Users

Adding User Roles

When you enable user and login features, a unique "Accounts" table is automatically included in your app. Every user who can log in to your app using an email and password will have their own individual record stored in the Accounts table.

However, you can also add additional user roles. These are different types of user "types" and will allow you to customize their permissions in the Live App.

To add new user roles, select the "+" button to the right of the "User Roles" text. This will walk you through creating a new user role.

aboutusers4

 

Adding User Records

Once you have enabled users, you have the ability to add individual users to your app. This can be done by adding records to your user roles tables or the Accounts table.

To add a new user, navigate to the Records section of the Builder and click on the "+ Add Record" button. User roles function the same as regular tables in your database.

Note: Similar to other tables, these user records can also be added with a form view from the Live App.
 aboutusersredo
 

 

Editing User Roles

To edit user roles, you have the option to click on the settings icon next to the user role name.

aboutusers6

 

In the user role settings, you can edit the following options:

  • Table Name: This represents the name of the user role.

  • Display Field: This field will be the visible representation of the record in connection fields.

  • Sort Order: This represents the default order in which records will be sorted within the user role.

  • Approval Template: This is the editable email template used to notify users that their accounts have been approved.

  • Account Info Template: This is the customizable email template used to send users their account information.

aboutusers7

 

Editing User Records

You have the ability to edit individual user records in both the Builder and the Live App.

aboutusers8

aboutusers10

 

Editing Users in the Builder

To edit user records in the Builder, simply navigate to the Records section and locate the user role you want to edit. From there, you can easily make changes by clicking on the edit icon next to the specific record.

Selecting the pen icon next to the record will open a form in a modal popup where you can modify the user record. Alternatively, you can also edit the record directly by selecting a specific cell on the record itself and inline-edit. 

aboutusers9

 

Editing Users in the Live App

You also have the option to edit user records directly from the Live App by utilizing an edit form view, which functions similarly to records in other tables.

 

 

Deleting User Roles

To delete a user role, click on the more options icon next to the user role name. Then, choose the "Delete" option. This will delete the user role but will not delete the user records in that role.

Those user records will remain in the main Accounts table without that role. 

aboutusers10
 

Caution: A user role, similar to tables, is a foundational part of your app. Deleting a user role may corrupt pages, views, and connections that use this user role.

 

Deleting User Records from the Builder

To delete user records, navigate to the Records section in the Builder. From there, you can simply use the checkboxes to select the specific records you want to delete.

Once the records are selected, new options will appear, allowing you to choose the "Delete" option.

aboutusers11

Tip: If you are looking to restrict access but would like to keep the user record for historical reference, you can set the User Status field value to "inactive" to prevent the user form logging in.

Note: Records can also be deleted in batches using the batch delete feature.

 

Deleting User Records from the Live App

App users have the ability to delete individual user records directly from the live app by including delete links in views. These delete links will then appear in the view for users to access.

Tip:  To learn more about applying delete links to your views, see our article here

 

 

User Settings

You have the option to select multiple user records using checkboxes and enable additional management features:

aboutusers12

 

As an example, you have the ability to approve multiple pending registered users simultaneously by updating their status and sending them an email notification informing them of the approval: 

aboutusers13

Tip: Click here to learn more on managing user records.

 

Using Users in Your App

Roles and Permissions

User roles are used to create different types of users.

For example, for a project management app, you may want Employee users who are responsible for completing project tasks and Supervisor users who are responsible for assigning tasks to Employees and approving new projects.

Each user can be assigned to multiple roles if necessary. A record will exist in each user role table that the user is assigned to.

These roles can be used to create different permissions to access your live app. When you add a login to a page, you can specify which roles can have permission to access that page:

aboutusers14

This approach allows you to create separate pages for various roles. Each role will have access to different pages, each with distinct views, fields, and workflows.

The page menu can be customized to display only the links to the pages that the logged-in user is authorized to access. As a result, each user will only be able to view the pages that they have been granted permission to see.

 

Adding User Logins

You have the option to require a login for any page in your live app.

To add a login, go to the Pages section of the Builder, then select the page you want to protect with a login. Click on the icon next to the page's name, and then select "Require a login".

You can also add a login from the lock icon at the top of the page navigation.

aboutusers15

A special login page will be created containing a single login view. That login view controls the settings for the login and any user registration options.

aboutusers16

Note: Every child page underneath that login page will now require a login to access.

Tip: Click here for more on managing logins and registrations.

 

 

Limiting Records to the Logged-in User

Another key feature is building your app so that each user can log in and only access their own records.

For example, if you have a project management app showing Projects, you want each Project Manager to log in and see their own Projects, not the Projects of any other Project Managers.

When you add views to a page that is protected by a login, you will have the opportunity to customize the view to suit your needs:

aboutusers17

Once an employee logs in, they will have access to view only the Projects that are connected to their user record.

Tip: Click here for more on displaying records connected to the logged-in user.

 

Notes & Troubleshooting

Accounts User Role

The Accounts user role table stores all user records. When deleting a user record, it is important to remove the record from both the user role and the Accounts table.

Overwriting Changes Made in the Live App or Builder

It is important to note that changes made by other users in the Knack Builder or the Live App can potentially overwrite your own changes. In other words, there is currently no way to prevent users from accessing the builder or a record in the live app when it is being edited by another user in a different session.

As such, we strongly encourage the following:

  • It is recommended that you have only one browser window or tab open while making changes to data in the Builder. If you or another shared builder on the app have an older version of the data open and save changes there, it can potentially overwrite the updates you have recently made.
  • In the Live App, we encourage creating a workflow or process to limit the number of users that might need to edit the same record at any one time.
 

How To Guides