PORTOS Developers
  • 👋Introduction
  • 📖Glossary
  • HTTP Status codes
  • Error models
  • Error codes
  • Validation constraints
  • Resource names
  • 🔒User rights
  • Device environments
  • 🌍Localization
  • 🔍NData query syntax
  • OpenAPI specification
  • Data models
  • Authentication
    • 🔐Authentication schemes
      • JWT Bearer Authentication
      • HMAC Authentication
  • ⚡Notifications
    • SignalR
    • Webhooks
  • API reference
    • 🔑API keys
    • 🛍️Article categories
    • 💼Companies
    • 💱Currencies
    • 👫Customers
    • 📈Daily sales reports
    • 🖥️Devices
    • 🖨️Fiscals
    • ❤️Health check
    • 📃License
    • 🎚️Modifiers
    • 👨‍🍳Order endpoints
    • 🛎️Orders
    • 🪙Payment types
    • ☕Plus
    • 🔏Roles
    • 🔐Sessions
    • ⚙️Settings
    • 🔎Stock takings
    • 🔢Stock transfer numbering
    • 🚚Stock transfers
    • 📦Stocks
    • 🧾Tickets
      • Ticket Model States
      • Ticket Operations and User Rights
      • Ticket Model Mathematics
    • 👨‍💼Users
    • ⚖️Vats
    • 🪑Zones
  • 3rd Party Integrations
    • Introduction
    • Online orders API
    • Rewards API
    • PDA Files
  • Previous versions
    • Migration to V4.1
    • Migration to V4
    • Legacy documentation
Powered by GitBook
On this page
  • API methods
  • Get roles
  • Get role by name
  • Create role
  • Create or update role
  • Delete role by name

Was this helpful?

  1. API reference

Roles

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

PreviousPlusNextSessions

Last updated 1 year ago

Was this helpful?

The PORTOS system has a predefined list of . Role allows to combine multiple user rights. When assigning rights to the user, roles are used. The role is represented by 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 .

Query Parameters

Name
Type
Description

name

string

Supports NData syntax.

label

string

Supports NData syntax.

$skip

int

Pagination property. Describing number of records to skip from beginning of result collection.

$take

int

Pagination property. Maximum count of items to be returned.

$sort

string[]

Comma separated list of property names. Please see NData syntax.

$count

bool

If set to true, response will not contain items collection. Use to get resource count, not the resources themselves.

Headers

Name
Type
Description

Authorization*

string

Authorization header with authorization token.

{
    "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}

Path Parameters

Name
Type
Description

name*

string

Unique role name.

Headers

Name
Type
Description

Authorization*

string

Authorization header with authorization token.

{
    "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
}
{
    "title": "Zdroj nebol nájdený",
    "status": 404
}

Create role

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

Required rights

Headers

Name
Type
Description

Authorization*

string

Authorization header with authorization token.

Request Body

Name
Type
Description

(body)*

Role

Role model to create

{
    "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}

Required rights

Path Parameters

Name
Type
Description

name*

string

Unique role name.

Headers

Name
Type
Description

Authorization*

string

Authorization header with authorization token.

Request Body

Name
Type
Description

(body)*

Role

Model to create or update.

{
    "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

Path Parameters

Name
Type
Description

name*

string

Unique role name.

Headers

Name
Type
Description

Authorization*

string

Authorization header with authorization token.

{
    "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
}
{
    "title": "Zdroj nebol nájdený",
    "status": 404
}

Result is of type .

Creates new role. Result is of type .

Authorized user must have RoleCreate assigned.

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

Authorized user must have assigned RoleCreate or RoleUpdate .

Authorized user must have RoleDelete assigned.

🔏
right
right
right
user rights
Role
QueryResult<Role>
Role
Role
Role