API Docs
HomeDocsWebsite
  • Home
  • Introduction
    • Authorization
      • Authorize
      • Get a Token
      • Third-Party Login
    • Field Types and Validation
      • Field Types
      • Validation
    • Query Manipulation
      • Constraints
      • Result Control
      • Value Filters
    • Entity Permissions
      • Restricted Scope
  • API reference
    • Infoboard
      • InfoboardChannels
      • InfoboardPosts
      • InfoboardPostSeenUsers
      • InfoboardPostReadUsers
      • InfoboardComments
      • InfoboardDepartmentSettings
    • Manual
      • ManualChapters
      • ManualEntries
      • ManualEntrySeenUsers
    • Calendar
      • Calendars
      • CalendarEvents
    • Filemanager
      • FilemanagerDirectories
      • FilemanagerFiles
    • Files
    • Forms
      • Forms
      • FormFields
      • FormFieldTypes
      • FormFieldValidations
      • FormFieldValidationTypes
      • FormMessages
      • FormMessageFields
    • Layouts
      • Layouts
      • LayoutRows
      • LayoutColumns
      • LayoutColumnLayoutElements
    • Tasks 2.0
      • TaskTemplates
      • TaskFields
      • TaskAssignments
      • TaskExecutions
      • TaskProgressFields
    • Departments
    • Roles
    • Permissions
    • Users
    • EntityPermissions
    • Notifications
    • Reactions
    • Icons
    • Folders
    • SharedItems
    • UrlContext
  • Resources
    • Release Notes
      • v2.106.0
      • v2.102.0
Powered by GitBook
On this page
  • Introduction
  • Model Definition
  • List
  • Show
  • Create
  • Update
  • Delete
  1. API reference

Roles

PreviousDepartmentsNextPermissions

Last updated 10 months ago

Introduction

Roles are used to manage Permissions in intratool.

The binding of Permissions to a Role is done by a pivot table called permission_role, in which each Permission of the unique Role is assigned.

Those Roles will then get assigned to a so that every member of a has the same Permissions unless the Permissions are not modified for a specific .

All this data can then be retrieved/created or modified via the Roles API.

Model Definition

Alias

role

Relations

Relation
Key
Type
Relation Field(s)

users

Has many

users.role_id

department

Belongs to

department_id

departments

Has many

departments.role_id

infoboard_departments

Belongs to many

Intermediate table

Permissions

permissions

Belongs to many

Intermediate table

List

Get a list of all Roles.

Definition

GET /api/roles

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/roles', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

[
  {
    "id": 2,
    "name": "Usergroup-1",
    "active": 1,
    "department_id": 2,
    "sort_number": 1,
    "created_at": "2019-01-21 13:55:33",
    "updated_at": "2019-01-21 13:56:22",
    "deleted_at": null,
    "department": {
      "id": 2,
      "name": "Usergroup-1"
    },
    "permissions": [
      {
        "id": 1,
        "type": "infoboard",
        "name": "infoboard-administration-rights",
        "description": "Administrationsrechte",
        "sort_number": 2
      },
      {
        "id": 12,
        "type": "infoboard",
        "name": "infoboard-show",
        "description": "Infoboard anzeigen",
        "sort_number": 1
      },
      {
        "id": 100,
        "type": "manual",
        "name": "manual-administration-rights",
        "description": "Administrationsrechte",
        "sort_number": 101
      }
    ]
  }
]

Show

Show a single Role by id.

Definition

GET /api/roles/{id}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/roles/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

{
  "id": 3,
  "name": "Usergroup-2",
  "active": 1,
  "department_id": 3,
  "sort_number": 2,
  "created_at": "2019-01-21 13:55:35",
  "updated_at": "2019-01-21 13:56:24",
  "deleted_at": null,
  "department": {
    "id": 3,
    "name": "Usergroup-2"
  },
  "permissions": [
    {
      "id": 12,
      "type": "infoboard",
      "name": "infoboard-show",
      "description": "Infoboard anzeigen",
      "sort_number": 1
    }
  ],
  "departments": [
    {
      "id": 3,
      "name": "Usergroup-2"
    }
  ],
  "infoboard_departments": [
    {
      "id": 3,
      "name": "Usergroup-2"
    }
  ]
}

Create

Create a new Role.

Definition

POST /api/roles

Request Keys

Key
Type
Default
Description

department_id *

integer

-

name *

string

-

Name of the Role

active

boolean

true

Whether the Role active

permissions_ids *

string

-

The granted Permissions of the Role

department_ids

string

Related Department

infoboard_department_ids

string

Related Department

sort_number

integer

Current highest +1

The index of the Role

Keys with * are required.

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/roles', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'department_id' => 7,
        'name' => 'Usergroup-4',
        'permission_ids' => '1'
    ]
]);

Example Response

{
  "status": "success",
  "data": {
    "department_id": 7,
    "name": "Usergroup-4",
    "sort_number": -1,
    "active": 1,
    "updated_at": "2019-01-24 15:58:18",
    "created_at": "2019-01-24 15:58:18",
    "id": 5
  }
}

Update

Update an existing Role by id.

Definition

PUT /api/roles/{id}

Request Keys

Key
Type
Description

department_id

integer

name

string

Name of the Role

active

boolean

Whether the Role active

permissions_ids

string

The granted Permissions of the Role

department_ids

string

infoboard_department_ids

string

sort_number

integer

The index of the Role

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/roles/5', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'department_ids' => '2'
    ]
]);

Example Response

{
  "status": "success",
  "data": {
    "id": 5,
    "name": "Usergroup-4",
    "active": 1,
    "department_id": 7,
    "sort_number": 4,
    "created_at": "2019-01-24 15:58:18",
    "updated_at": "2019-01-24 15:58:19",
    "deleted_at": null
  }
}

Delete

Delete an existing Role by id.

Definition

DELETE /api/roles/{id}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/roles/5', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

{
  "status": "success",
  "data": []
}

Related

The the Role has access to view content from

The the Role is allowed to assign to

Related

The the Role has access to view content from

The the Role is allowed to assign to

Department
Department
User
Users
Department
Departments
Departments
Department
Departments
Departments
InfoboardPosts
Department
Departments
Departments
InfoboardPosts