You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2024-02-20 14:45:32

scma
Member
Registered: 2024-02-20
Posts: 1

Link a document to a ticket (access rights issue)

Hello,

I'm trying to link a document to a ticket in Postman but i'm getting this error:

[
    "ERROR_GLPI_ADD",
    "Vous n'avez pas les droits requis pour réaliser cette action."
]

I'm able to create a ticket and a document with the same authentification token.

The user is super admin in GLPI.

What am I missing there ?

Thanks for your help

Offline

#2 2024-02-21 12:39:25

belu33fr
Member
Registered: 2011-03-25
Posts: 145

Re: Link a document to a ticket (access rights issue)

Hi,
HAve you an error when you add a document to entity or generally?
If true, I think thak your folder have not the right acls (755) or wrong owner.
Good luck
Have a nice day

Offline

#3 2024-04-17 10:11:54

RIMuser
Member
Registered: 2024-02-23
Posts: 10

Re: Link a document to a ticket (access rights issue)

Hello,
I am having the same issue.
Document is uploaded.

Here is how I am doing :

// Création du fichier (enregistrement dans Documents)
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $uploadUrl);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            "session-token: $sessionToken",
            "App-Token: $appToken"
        ));
        $filePath = realpath($fileTmpName);

        $postFields = array(
            'uploadManifest' => json_encode([
                'input' => [
                    'name' => $fileName,
                    'documentcategories_id' => 5, // Set appropriate category ID
                    'tickets_id' => $ticketId // Attach to the newly created ticket
                ]
            ]),
            'filename[0]' => new CURLFile($filePath, $fileType, $fileName)
        );
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $uploadResponse = curl_exec($ch);
        curl_close($ch);

        $documentId = json_decode($uploadResponse)->id;

// Création de la relation ticket / document
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $createUrl.'/'.$ticketId.'/Document_Item');
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            "session-token: $sessionToken",
            "App-Token: $appToken",
            "Content-Type: application/json"
        ));

        $associationData = json_encode([
            'input' => [
                'documents_id' => $documentId,
                'itemtype' => 'Ticket',
                'items_id' => $ticketId
            ]
        ]);
        echo json_encode(['contenu attached' => $associationData]);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $associationData);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($ch);
        curl_close($ch);

        echo json_encode(['Réponse attached' => $response]);

Getting ERROR_GLPI_ADD

Offline

Board footer

Powered by FluxBB