Skip to content

SharedItems

Introduction

SharedItems are used to share a targeted entity or custom defined content via a never-changing, unique URL.

Each SharedItem has a concrete type which defines which targetables are allowed and which config information must/can be provided. It also determindes what the SharedItem actually does, when it's accessed by URL.

There are several different authorization types available for SharedItems. They define wo can access the SharedItem. It is possible to change the authorization type at any time.

Model

Namespace

Modules\Core\Entities

Relations

RelationKeyTypeRelation Field(s)
UseruserBelongs touser_id
TargetabletargetableMorph totargetable_type, targetable_id
AuthorizeForauthorizeForMorph toauthorized_for_type, authorized_for_id
EntityPermissionsentityPermissionsMorph many

Types

Authorization Types

  • none - Not accessable.
  • public - Accessable for all authenticated users.
  • targetable - Access defined by permissions of the Targetable entity.
  • authorizedFor - Access defined by permissions of the AuthorizeFor entity.
  • entityPermissions - Access determined by defined

List

Get a list of all SharedItems.

Definition

GET /api/shared-items

Example Request

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

Example Response

json
[
  {
    "id": "9ae0e631-37b4-4ef0-8a26-1526f329098a",
    "user_id": 1,
    "type": "manualEntry",
    "authorization_type": "authorizedFor",
    "targetable_type": "manualEntry",
    "targetable_id": 1,
    "authorized_for_type": "manualEntry",
    "authorized_for_id": 1,
    "config": {},
    "created_at": "2024-01-01 12:00:00",
    "updated_at": "2024-01-01 12:00:00",
    "deleted_at": null
  },
  {
    "status": "success",
    "data": {
      "id": "9ae33ff8-93b8-49b7-bbd6-7b44970c205f",
      "user_id": 1,
      "type": "form",
      "authorization_type": "targetable",
      "targetable_type": "form",
      "targetable_id": 1,
      "authorized_for_type": null,
      "authorized_for_id": null,
      "config": {},
      "created_at": "2024-01-01 12:00:00",
      "updated_at": "2024-01-01 12:00:00",
      "deleted_at": null
    }
  }
]

Show

Show a single SharedItem by id.

Definition

GET /api/shared-items/{id}

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/shared-items/9ae33ff8-93b8-49b7-bbd6-7b44970c205f', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

json
{
  "status": "success",
  "data": {
    "id": "9ae33ff8-93b8-49b7-bbd6-7b44970c205f",
    "user_id": 1,
    "type": "form",
    "authorization_type": "targetable",
    "targetable_type": "form",
    "targetable_id": 1,
    "authorized_for_type": null,
    "authorized_for_id": null,
    "config": {},
    "created_at": "2024-01-01 12:00:00",
    "updated_at": "2024-01-01 12:00:00",
    "deleted_at": null
  }
}

Create

Create a new SharedItem.

Definition

POST /api/shared-items

Request Keys

KeyTypeDefaultDescription
type *string-The type of the SharedItem.
authorization_typestringBased on typeThe authorization type of the SharedItem.
targetable_typestring-The morph type for the targetable relation.
targetable_idinteger, string-The morph ID for the targetable relation.
authorized_for_typestring-The morph type for the authorizeFor relation.
authorized_for_idinteger, string-The morph ID for the authorizeFor relation.
configarrayBased on typeThe configuration for the SharedItem. Available values depend on type.

Keys with * are required.

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/shared-items', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'type' => 'filemanagerDirectory',
        'targetable_type' => 'filemanagerDirectory',
        'targetable_id' => 1
    ]
]);

Example Response

json
{
  "id": "9ae0b789-7da8-46ae-b426-f9a410e04aed",
  "user_id": 1,
  "type": "filemanagerDirectory",
  "authorization_type": "targetable",
  "targetable_type": "filemanagerDirectory",
  "targetable_id": 1,
  "authorized_for_type": null,
  "authorized_for_id": null,
  "config": {
    "show_subdirectories": false
  },
  "created_at": "2024-01-01 12:00:00",
  "updated_at": "2024-01-01 12:00:00",
  "deleted_at": null
}

Update

Update an existing SharedItem by id.

Definition

PUT /api/shared-items/{id}

Request Keys

KeyTypeDefaultDescription
authorization_typestringBased on typeThe authorization type of the SharedItem.
authorized_for_typestring-The morph type for the authorizeFor relation.
authorized_for_idinteger, string-The morph ID for the authorizeFor relation.
configarrayBased on typeThe configuration for the SharedItem. Available values depend on type.

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/shared-items/9ae0b789-7da8-46ae-b426-f9a410e04aed', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'authorization_type' => 'authorizedFor',
        'authorized_for_type' => 'infoboardPost',
        'authorized_for_id' => 1,
        'config' => [
              'show_subdirectories' => true
        ]
    ]
]);

Example Response

json
{
  "id": "9ae0b789-7da8-46ae-b426-f9a410e04aed",
  "user_id": 1,
  "type": "filemanagerDirectory",
  "authorization_type": "authorizedFor",
  "targetable_type": "filemanagerDirectory",
  "targetable_id": 1,
  "authorized_for_type": "infoboardPost",
  "authorized_for_id": 1,
  "config": {
    "show_subdirectories": true
  },
  "created_at": "2024-01-01 12:00:00",
  "updated_at": "2024-02-02 13:00:00",
  "deleted_at": null
}

Delete

Delete an existing SharedItem by id.

Definition

DELETE /api/shared-items/{id}

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/shared-items/9ae0b789-7da8-46ae-b426-f9a410e04aed', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

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