# Roles

Roles are a way to group authorities, It defines what users can or can't do in the console and devices in your account. Multiple roles can be assigned to users and will be applied to all branches to which the user belongs.

# The Role Object

# Sample

{
  "id": "8cd1956b",
  "name": "Admin",
  "name_localized": null,
  "users": [
    {
      "id": "8f7ab326",
      "pivot": {
        "role_id": "8cd1956b",
        "user_id": "8f7ab326"
      }
    }
  ],
  "authorities": [
    "menu:read"
  ],
  "created_at": "2019-02-11 07:28:29",
  "updated_at": "2019-02-11 07:28:29",
  "deleted_at": null
}

# Attributes

Field Type Rule Description
id string Unique identifier for the role.
name* string updatable Name of the role.
name_localized string nullable updatable Localized name of the role.
users array nullable updatable includable List of User objects attached to the role.
authorities array nullable updatable includable List of Authorities attched to the role.
created_at string sortable Time YYYY-MM-DD HH-MM-SS in UTC at which the object was created.
updated_at string sortable Time YYYY-MM-DD HH-MM-SS in UTC at which the object was updated.
deleted_at string nullable Time YYYY-MM-DD HH-MM-SS in UTC at which the object was deleted.

# Authorities

Authorities determine what abilities the users attached to the role can have, some authorities are in the global scope while others are related to which branches the users are attached to.

# Orders Authorities
Authority Description
orders:read Ability to read orders
orders:manage_tags Ability to manage orders tags
# Customers Authorities
Authority Description
customers:read Ability to read customers
customers:read_insights Ability to read customers insights
customers:manage Ability to manage customers
customers:manage_house_account Ability to manage customers house accounts
customers:manage_loyalty Ability to manage customers loyalty
# Inventory Authorities
Authority Description
inventory_items:read Ability to read inventory items
inventory_items:manage Ability to manage inventory items
suppliers:read Ability to read suppliers
suppliers:manage Ability to manage suppliers
po:drafts:manage Ability to manage drafted purchase orders
po:posted:manage Ability to manage posted purchase orders
po:approved:manage Ability to manage approved purchase orders
to:drafts:manage Ability to manage drafted transfer orders
to:approved:manage Ability to manage approved transfer orders
transfers:drafts:manage Ability to manage drafted transfer transactions
transfers:closed:manage Ability to manage closed transfer transactions
purchasing:drafts:manage Ability to manage drafted purchasing transaction
purchasing:closed:manage Ability to manage closed purchasing transaction
production:drafts:manage Ability to manage drafted production transaction
production:closed:manage Ability to manage closed production transaction
quantity_adjustment:drafts:manage Ability to manage drafted quantity adjustment transaction
quantity_adjustment:closed:manage Ability to manage closed quantity adjustment transaction
cost_adjustment:drafts:manage Ability to manage drafted cost adjustment transaction
cost_adjustment:closed:manage Ability to manage closed cost adjustment transaction
inventory_count:drafts:manage Ability to manage drafted inventory count
inventory_count:closed:manage Ability to manage closed inventory count
order_transactions:read Ability to read order transaction
Authority Description
menu:read Ability to read menu
menu:manage Ability to manage menu
# Other Authorities
Authority Description
ingredients:manage Ability to manage inventroy item and product ingredients
cost:manage Ability to manage inventroy item and product cost
# Admin Authorities
Authority Description
gift_cards:manage Ability to manage (Gift Cards)
users:manage Ability to manage (Users)
promotions:manage Ability to manage (Promotions)
timed_events:manage Ability to manage (Timed Events)
discounts:manage Ability to manage (Discounts)
coupons:manage Ability to manage (Coupons)
devices:manage Ability to manage (Devices)
branches:manage Ability to manage (Branches)
settings:read Ability to read (Settings)
settings:manage Ability to manage (Settings)
apps:manage Ability to manage applications

# List Roles

GET /roles

# Scope

users.read

# Filters

  • id
  • name
  • name_localized
  • users.id
  • updated_after
  • is_deleted
  • created_on
  • updated_on
  • deleted_on

# Response

{
  "data": [
    {
      "id": "8cd1956b",
      "name": "Admin",
      "name_localized": null,
      "users": [
        {
          "id": "8f7ab326",
          "pivot": {
            "role_id": "8cd1956b",
            "user_id": "8f7ab326"
          }
        }
      ],
      "authorities": [
        "menu:read"
      ],
      "created_at": "2019-02-11 07:28:29",
      "updated_at": "2019-02-11 07:28:29",
      "deleted_at": null
    }
  ]
}

# Get Role

GET /roles/{roleId}

# Scope

users.read

# Response

{
  "data": {
    "id": "8cd1956b",
    "name": "Admin",
    "name_localized": null,
    "users": [
      {
        "id": "8f7ab326",
        "pivot": {
          "role_id": "8cd1956b",
          "user_id": "8f7ab326"
        }
      }
    ],
    "authorities": [
      "menu:read"
    ],
    "created_at": "2019-02-11 07:28:29",
    "updated_at": "2019-02-11 07:28:29",
    "deleted_at": null
  }
}

# Create Role

POST /roles

# Scope

users.write

# Request

{
    "name": "Admin",
    "name_localized": null,
    "users": [
        {
            "id": "8cd1956b"
        }
    ],
    "authorities": [
        "menu:read"
    ]
}

# Response

{
  "data": {
    "id": "8cd1956b",
    "name": "Admin",
    "name_localized": null,
    "users": [
      {
        "id": "8f7ab326",
        "pivot": {
          "role_id": "8cd1956b",
          "user_id": "8f7ab326"
        }
      }
    ],
    "authorities": [
      "menu:read"
    ],
    "created_at": "2019-02-11 07:28:29",
    "updated_at": "2019-02-11 07:28:29",
    "deleted_at": null
  }
}

# Update Role

PUT /roles/{roleId}

# Scope

users.write

# Request

{
    "name": "Admin",
    "name_localized": null,
    "users": [
        {
            "id": "8cd1956b"
        }
    ],
    "authorities": [
        "menu:read"
    ]
}

# Response

{
  "data": {
    "id": "8cd1956b",
    "name": "Admin",
    "name_localized": null,
    "users": [
      {
        "id": "8f7ab326",
        "pivot": {
          "role_id": "8cd1956b",
          "user_id": "8f7ab326"
        }
      }
    ],
    "authorities": [
      "menu:read"
    ],
    "created_at": "2019-02-11 07:28:29",
    "updated_at": "2019-02-11 07:28:29",
    "deleted_at": null
  }
}

# Delete Role

DELETE /roles/{roleId}

# Scope

users.write

The API will respond with 200 indicating that the role has been deleted.

# Restore Role

PUT /roles/{roleId}/restore

# Scope

admin.restore

The API will respond with 200 indicating that the role has been restored.

Last Updated: 21/9/2023, 9:27:45 AM