コード例 #1
0
$documentGuid = $serializedData['DocumentGuid'];
$collaboratorGuid = $serializedData['UserGuid'];
if ($documentGuid != "" && $collaboratorGuid != '') {
    //Create signer object
    $signer = new GroupDocsRequestSigner(trim($privateKey));
    //Create apiClient object
    $apiClient = new APIClient($signer);
    //Create AsyncApi object
    $antApi = new AntApi($apiClient);
    //Get all collaborators for current document
    $getCollaborators = $antApi->GetAnnotationCollaborators($clientId, $documentGuid);
    if ($getCollaborators->status == "Ok") {
        //Create ReviewerInfo array
        $reviewer = new ReviewerInfo();
        //Loop for checking all collaborators
        for ($n = 0; $n < count($getCollaborators->result->collaborators); $n++) {
            //Set reviewer rights to view only
            if ($getCollaborators->result->collaborators[$n]->guid == $collaboratorGuid) {
                //Add riviewer to ReviewerInfo array
                $reviewer->id = $getCollaborators->result->collaborators[$n]->id;
                $reviewer->access_rights = 1;
                $reviewer = array($reviewer);
            }
        }
        $setReviewer = $antApi->SetReviewerRights($clientId, $documentGuid, $reviewer);
    }
    //path to settings file - temporary save signed document GUID like to property file
    $infoFile = fopen(__DIR__ . '/../../callback_info.txt', 'w');
    fwrite($infoFile, "User rights was set to view only");
    fclose($infoFile);
}
コード例 #2
0
ファイル: sample22.php プロジェクト: groupdocs/groupdocs-php
 if ($newUser->status == "Ok") {
     //### If request was successfull
     //Create Annotation api object
     $ant = new AntApi($apiClient);
     $ant->setBasePath($basePath);
     //Create array with entered email for SetAnnotationCollaborators method
     $arrayEmail = array($email);
     //Make request to Ant api for set new user as annotation collaborator
     $addCollaborator = $ant->SetAnnotationCollaborators($clientId, $fileId, "2.0", $arrayEmail);
     if ($addCollaborator->status == "Ok") {
         //Make request to Annotation api to receive all collaborators for entered file id
         $getCollaborators = $ant->GetAnnotationCollaborators($clientId, $fileId);
         if ($getCollaborators->status == "Ok") {
             //Set reviewers rights for new user. $newUser->result->guid - GuId of created user, $fileId - entered file id,
             //$getCollaborators->result->collaborators - array of collabotors in which new user will be added
             $setReviewer = $ant->SetReviewerRights($newUser->result->guid, $fileId, $getCollaborators->result->collaborators);
             if ($setReviewer->status == "Ok") {
                 //Generating iframe for template
                 if ($basePath == "https://api.groupdocs.com/v2.0") {
                     $iframe = 'https://apps.groupdocs.com//document-annotation2/embed/' . $fileId . '?&uid=' . $newUser->result->guid . '&download=true';
                     //iframe to dev server
                 } elseif ($basePath == "https://dev-api.groupdocs.com/v2.0") {
                     $iframe = 'https://dev-apps.groupdocs.com//document-annotation2/embed/' . $fileId . '?&uid=' . $newUser->result->guid . '&download=true ';
                     //iframe to test server
                 } elseif ($basePath == "https://stage-api-groupdocs.dynabic.com/v2.0") {
                     $iframe = 'https://stage-apps-groupdocs.dynabic.com/document-annotation2/embed/' . $fileId . '?&uid=' . $newUser->result->guid . '&download=true ';
                 } elseif ($basePath == "http://realtime-api.groupdocs.com") {
                     $iframe = 'http://realtime-apps.groupdocs.com/document-annotation2/embed/' . $fileId . '?&uid=' . $newUser->result->guid . '&download=true ';
                 }
                 $iframe = $signer->signUrl($iframe);
             } else {