> For the complete documentation index, see [llms.txt](https://skaleptyltd.gitbook.io/build-solution/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://skaleptyltd.gitbook.io/build-solution/product-guides/system/permission.md).

# Permission

{% hint style="info" %}
The system provides users with the ability to perform three main actions on permissions for different user types:

1. Create: Users can create new permissions, defining the access levels for various user types.
2. Edit: Users have the option to modify existing permissions, making changes to the access rights of different user types.
3. Delete: Users can remove permissions, effectively revoking specific access privileges for different user types.
   {% endhint %}

{% tabs %}
{% tab title="Navigation to the page" %}

* Login as an Admin > System > Permission<br>

  <figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2F7rhAy7vsHefzI8n9NcCU%2Fimage.png?alt=media&amp;token=af972f4a-0c94-453c-80f8-78d5c59caa17" alt=""><figcaption><p>Navigation to Permissions</p></figcaption></figure>

{% endtab %}

{% tab title="Functions & validations" %}

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2FVU995uSJiKU7XXD0JHGp%2Fimage.png?alt=media&amp;token=b4afb4a1-eacb-4248-ba38-50b30d2623a5" alt=""><figcaption><p>Permissions table</p></figcaption></figure>

In the user interface, the user has the option to choose how many records they want to see on a single page. They can set a specific number to control the amount of information displayed at once.

Furthermore, the system allows the user to filter the records by typing the permission name in a search box. As they type, the relevant records that match the permission name will be dynamically filtered and displayed, making it easier for the user to find specific permissions quickly.

***

**Create Permission**

When the user clicks on the "Create Permission" button, they are immediately taken to a form where they can input the necessary information to create a new permission.

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2FU4TOmt8FeueIz4h2AsJW%2Fimage.png?alt=media&amp;token=4f25e4a5-8eef-4e12-b571-8c2e805faec8" alt=""><figcaption><p>Create Permission form</p></figcaption></figure>

The "Create Permission" form consists of two fields: a text field for entering the permission name and a dropdown menu with two options: "Role" and "User." The user can choose between these options to determine whether to assign permission to a specific user role or to an individual user.

In addition to these fields, there are multiple checkboxes available for selecting user roles. Users can choose multiple user roles while creating the permission, allowing them to assign the permission to multiple roles at once.

When the user clicks on the "Submit" button, they are redirected back to the permissions page. A success banner appears, indicating that the permission created was successful.

> Important points to think about when making permissions:
>
> * There are two kinds of permissions: "ROLE" and "USER".
> * When you name a permission, you can use the format you're already using (like "view\.permissions").
> * If you choose "ROLE" as the type and pick roles at the bottom, the permission you make will be given to those roles right away.

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2FZLxDp4ZfHHqF0QvyqTMg%2Fimage.png?alt=media&amp;token=06cfc398-6efc-4c5e-8f63-110d2576ed6f" alt=""><figcaption><p>Create Permission success banner</p></figcaption></figure>

***

**Edit Permission**

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2F1nFYxWrmv0PGW7PzC92i%2Fimage.png?alt=media&amp;token=37fec6dd-ed99-4396-8f04-fc8e02e418ed" alt=""><figcaption><p>Edit Permission form</p></figcaption></figure>

When the user clicks on the "Edit" button of a specific permission record, they are directed to the "Edit Permission" form. In this form, the name and type fields are automatically filled with the existing values of the permission. However, the user can update these fields with new values.

Unlike the "Create Permission" form, the checkboxes for selecting user roles are not visible in the "Edit Permission" form.

After the user updates the permission details and clicks on the "Submit" button, they are redirected back to the permissions page. A success banner appears, indicating that the permission update was successful.

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2FrbKGCMqjhC1AfSEAFAkJ%2Fimage.png?alt=media&amp;token=ff1687a4-057d-44b0-9cc8-4510a95b4a75" alt=""><figcaption><p>Update success banner</p></figcaption></figure>

In the "Edit Permission" form, just like in the "Create Permission" form, all the fields are required to be filled out. This means that the user must provide information for all the fields before they can successfully update the permission details.

***

**Delete Permission**

When the user clicks on the "Delete" button of a permission record, a pop-up message will appear asking for confirmation. If the user clicks on the "OK" button in the pop-up, the record will be deleted, and a success banner will be displayed to confirm the successful deletion.

On the other hand, if the user clicks on the "No" button in the pop-up, nothing will happen to the record, and it will remain unchanged. The deletion process will be canceled, and the user can continue without deleting the record.\ <br>

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2FTABF1EhO8DkN0CW3DFLX%2Fimage.png?alt=media&amp;token=888a8404-ad9a-4460-8ec6-3c1867f3606b" alt=""><figcaption><p>Delete confirmation message</p></figcaption></figure>

<figure><img src="https://1721684721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPaF9cGX0SlYrvgRNs9Wi%2Fuploads%2F2aKZEA2Tkxir7J4sPJuP%2Fimage.png?alt=media&amp;token=c20c195f-6399-4892-88c3-f048908d1436" alt=""><figcaption><p>Delete success banner</p></figcaption></figure>
{% endtab %}

{% tab title="Database tables and queries" %}
Below are the related DB tables:

* permission
  {% endtab %}

{% tab title="Paths" %}

#### Function Path

```
app/Http/Controllers/Admin/PermissionController.php
```

{% endtab %}
{% endtabs %}

*<mark style="color:red;">Why do permission names have a '.' in between? And the '.'  in the permission name is not displaying in create role form?</mark>*

*<mark style="color:red;">Can we sort the permissions table??</mark>*

Admin users have the ability to create, edit, and delete permissions that can be assigned to user roles.

*<mark style="color:red;">Who else is permitted to create, edit, and delete permissions?</mark>*

*<mark style="color:red;">What is the purpose of the 'Type' dropdown?</mark>*&#x20;

*<mark style="color:red;">What is the purpose of letting the user select roles if creating permission type is User?</mark>*

*<mark style="color:red;">Why are checkboxes not displaying in the edit form?</mark>*
