Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

QMS API Bug

Hello,

I'm trying to add a Document Administrators via the QMS API with following code, which works for 1 user:

                $myname="MyReport";

                $myuser='user1,user2'; //to be changed

                //var_dump($this->getQVSSettings()->Folders->UserDocumentAdministrators); //print possible properties

                $tmp=0;

                foreach (getArray($this->getQVSSettings()->Folders->UserDocumentMounts->QVSMount) as $mountedFolder)

                {

                    //print_r("___ ".$mountedFolder->Name."___ ");

                    $myfolderID=$mountedFolder->FolderID;

                    //var_dump($qlikviewUserDocumentFoldersTmp[0]->Administrators=array('user1','user2'));

                    if ($mountedFolder->Name == $myname)

                    {

                        //print_r("Mounted Folder name: ".$mountedFolder->Name);

                        //print_r("Folder ID: ".$myfolderID);

                        $myqlikviewQVSSettings = new stdClass();

                        $myqlikviewQVSSettings = $this->client->GetQVSSettings(array('qvsID' => $this->qlikviewServerInfo->ServiceInfo->ID, 'scope' => 'Logging'))->GetQVSSettingsResult;

                        $myqlikviewQVSSettings->Cluster = $this->getQVSSettings()->Cluster;

                        $myqlikviewQVSSettings->Distribution =$this->getQVSSettings()->Distribution;

                        $myqlikviewQVSSettings->Documents = $this->getQVSSettings()->Documents;

                        $myqlikviewQVSSettings->Folders = $this->getQVSSettings()->Folders;

                        foreach (getArray($myqlikviewQVSSettings->Folders->UserDocumentAdministrators->QVSFolderAdministrator) as $OneAdminFolder)

                        {

                            if($OneAdminFolder->FolderID==$myfolderID)

                               {

                                   print_r("Found correct folder ID : ".$OneAdminFolder->FolderID);

                                   $OneAdminFolder->UserName=$myuser;

                               }

                        }

                        $myqlikviewQVSSettings->General = $this->getQVSSettings()->General;

                        $myqlikviewQVSSettings->Logging = $this->getQVSSettings()->Logging;

                        $myqlikviewQVSSettings->Performance=$this->getQVSSettings()->Performance;

                        $myqlikviewQVSSettings->QVSID = $this->getQVSSettings()->QVSID;

                        $myqlikviewQVSSettings->Scope=$this->getQVSSettings()->Scope;

                        $myqlikviewQVSSettings->Security=$this->getQVSSettings()->Security;

                        $this->client->SaveQVSSettings(array('qvsSettings' => $myqlikviewQVSSettings)); //save the new QVS Settings into the QMC

                    }

                    $tmp++;

                }

               

Everything goes nice, no error. I open now my QMC and check at http://my-ip:4780/qmc/SystemSetup.htm# and want to check if it was done, nothing is there.

Let's change a bit and put $myuser='user1';

This works great, only if there is already an administrator for a document folder, then I can assign him an user and it removes the old administrator from the document folder and sets the new one instead.

My question, how can I add a second user as document administrator without erasing the previous one and why can I add : $myuser='user1,user2'; and it doesn't returns me an error?

Yours,

Mike

0 Replies