🔏Roles

This page provides a description of the available API routes for managing roles.

The PORTOS system has a predefined list of user rights. Role allows to combine multiple user rights. When assigning rights to the user, roles are used. The role is represented by Role class. Roles can be freely managed using API routes described in this section.

For instance, a user possessing the "sale" role would be granted rights such as ticketCreate, ticketUpdate, and ticketClose. Roles can be used to group user rights based on areas of work or represent specific job positions like "cashier," "waiter," or "manager."

During product installation, the default roles setup is established, and it follows a more detailed approach, allowing precise role management, such as "sale", "stats", "storno," etc.

API methods

Get roles

GET http://{server-address}/roles

Returns all roles that matches query parameters. Result is of type QueryResult<Role>.

Query Parameters

Headers

{
    "items":
    [
        {
            "name": "admin",
            "label": "Administrátor",
            "description": "Administrátorské oprávnenie, umožňuje vykonávať všetky akcie v tých zariadeniach, pre ktoré ma umožnené prihlásenie",
            "rights":
            [
                "admin"
            ],
            "envNames":
            [
                "BackOffice",
                "CashRegister",
                "PDA",
                "Tool"
            ],
            "_v": 1
        },
        {
            "name": "articleCategories",
            "label": "Správa tovarových skupín",
            "description": "Umožňuje používateľovi vytvárať, upravovať a mazať tovarové skupiny",
            "rights":
            [
                "articleCategoryCreate",
                "articleCategoryUpdate",
                "articleCategoryDelete"
            ],
            "envNames":
            [
                "BackOffice"
            ],
            "_v": 1
        }
    ],
    "count": 2,
    "totalCount": 2
}

Get role by name

GET http://{server-address}/roles/{name}

Result is of type Role.

Path Parameters

Headers

{
    "name": "articleCategories",
    "label": "Správa tovarových skupín",
    "description": "Umožňuje používateľovi vytvárať, upravovať a mazať tovarové skupiny",
    "rights":
    [
        "articleCategoryCreate",
        "articleCategoryUpdate",
        "articleCategoryDelete"
    ],
    "envNames":
    [
        "BackOffice"
    ],
    "_v": 1
}

Create role

POST http://{server-address}/roles

Creates new role. Result is of type Role.

Required rights

Authorized user must have RoleCreate right assigned.

Headers

Request Body

{
    "name": "articleCategories",
    "label": "Správa tovarových skupín",
    "description": "Umožňuje používateľovi vytvárať, upravovať a mazať tovarové skupiny",
    "rights":
    [
        "articleCategoryCreate",
        "articleCategoryUpdate",
        "articleCategoryDelete"
    ],
    "envNames":
    [
        "BackOffice"
    ],
    "_v": 1
}

Create or update role

PUT http://{server-address}/roles/{name}

Updates existing or creates new role. Result is of type Role.

Required rights

Authorized user must have assigned RoleCreate or RoleUpdate right.

Path Parameters

Headers

Request Body

{
    "name": "articleCategories",
    "label": "Správa tovarových skupín",
    "description": "Umožňuje používateľovi vytvárať, upravovať a mazať tovarové skupiny",
    "rights":
    [
        "articleCategoryCreate",
        "articleCategoryUpdate",
        "articleCategoryDelete"
    ],
    "envNames":
    [
        "BackOffice"
    ],
    "_v": 2
}

Delete role by name

DELETE http://{server-address}/roles/{name}

Required rights

Authorized user must have RoleDelete right assigned.

Path Parameters

Headers

{
    "name": "articleCategories",
    "label": "Správa tovarových skupín",
    "description": "Umožňuje používateľovi vytvárať, upravovať a mazať tovarové skupiny",
    "rights":
    [
        "articleCategoryCreate",
        "articleCategoryUpdate",
        "articleCategoryDelete"
    ],
    "envNames":
    [
        "BackOffice"
    ],
    "_v": 1
}

Last updated