Permissions

Codejig permission is a set of permissible actions which can be applied to one or more data types. Default permission is applied to the data types unless you create and use another one.

HOW TO:

Create a user role

To create a user role, from the Permission page in the Builder, click on the plus near USER ROLE, enter the name of the role and save it.

User roles usage

 

If you select the "In any of roles" filter, you will also have to specify the roles from the dropdown list of existing roles.

Show all permissible actions

To open all permissible actions from the Permission page, click on the Show unset.

Now you can apply for all possible actions.

Create a new permission

From the Project menu ⇒ Permissions, click Create new. Then add the name to the permission and click create.

 

The new permission has the same properties as the default one.

Apply permission to a specific data type

Newly created data types use the Default permission. To apply different permission to a data type:

1) Go to the type details page and start editing its properties:

2) Select the Permission you need and save the type properties.

Grant access programmatically

If you select the "Custom" filter, you will have to populate a code block with your custom logic.

For example, the code below allows access only if a user has a Teacher User role.

Import a user role in the Code Editor

You can use the User roles you create in the Code Blocks.

It is UserRole system type instan        ces. And if you fetch it, you can use it in the code blocks.

Fetching UserRole instances is very useful for permissions.

Add a role for the user

Note: only App admins can assign user roles for the users. You can not add a role for the user from Builder.

Go to your application Admin tools ⇒ User accounts. You will see the page with all the registered users.

To assign a role to a user, click on the corresponding pencil icon and then select the User role.

FAQ:

What does “Use Default” mean?

The "Use default" filter means that the permission filter from the "Default" action should be applied.

What is the difference between permission actions?

Read: view and export the type.

Execute: perform server actions, API functions and for working with Reports.

Write: Create, Update, Delete and change the type pages.

Post/Unpost: set permission for the Document post and unpost actions.

I need to select another default permission.

In the App Builder, go to the App settings page. There, in the Permissions tab, select the permission you need.