/** * Delete user in adobe connect * @param $user object with the following fields: username, idnumber, email, firstname, lastname, password * @return bool */ function connectsync_delete_user($user) { if ($aconnect = aconnect_login()) { $pid = aconnect_user_exists($aconnect, $user); if ($pid) { $rvalue = aconnect_delete_user($aconnect, $pid); // Pid = principle id. echo "Deleted user: "******" in Adobe Connect\n"; } else { $rvalue = true; // TODO User doesn't exist.....delete successful log? } } else { // TODO: Logging? Log trouble connecting? $rvalue = false; } aconnect_logout($aconnect); return $rvalue; // Do nothing. }
function adobe_connection_test($host = '', $port = 80, $username = '', $password = '', $httpheader = '', $emaillogin) { if (empty($host) or empty($port) or 0 == $port or empty($username) or empty($password) or empty($httpheader)) { echo "</p>One of the required parameters is blank or incorrect: <br />" . "Host: {$host}<br /> Port: {$port}<br /> Username: {$username}<br /> Password: {$password}" . "<br /> HTTP Header: {$httpheader}</p>"; die; } $messages = array(); $aconnectDOM = new connect_class_dom($host, $port, $username, $password); $params = array('action' => 'common-info'); // Send common-info call to obtain the session key echo '<p>Sending common-info call:</p>'; $aconnectDOM->create_request($params); if (!empty($aconnectDOM->_xmlresponse)) { // Get the session key from the XML response $aconnectDOM->read_cookie_xml($aconnectDOM->_xmlresponse); $cookie = $aconnectDOM->get_cookie(); if (empty($cookie)) { echo '<p>unable to obtain session key from common-info call</p>'; echo '<p>xmlrequest:</p>'; $doc = new DOMDocument(); if ($doc->loadXML($aconnectDOM->_xmlrequest)) { echo '<p>' . htmlspecialchars($doc->saveXML()) . '</p>'; } else { echo '<p>unable to display the XML request</p>'; } echo '<p>xmlresponse:</p>'; $doc = new DOMDocument(); if ($doc->loadXML($aconnectDOM->_xmlresponse)) { echo '<p>' . htmlspecialchars($doc->saveHTML()) . '</p>'; } else { echo '<p>unable to display the XML response</p>'; } } else { // print success echo '<p style="color:#006633">successfully obtained the session key: ' . $aconnectDOM->get_cookie() . '</p>'; // test logging in as the administrator $params = array('action' => 'login', 'login' => $aconnectDOM->get_username(), 'password' => $aconnectDOM->get_password()); $aconnectDOM->create_request($params); if ($aconnectDOM->call_success()) { echo '<p style="color:#006633">successfully logged in as admin user</p>'; //$username //Test retrevial of folders echo '<p>Testing retrevial of shared content, recording and meeting folders:</p>'; $folderscoid = aconnect_get_folder($aconnectDOM, 'content'); if ($folderscoid) { echo '<p style="color:#006633">successfully obtained shared content folder scoid: ' . $folderscoid . '</p>'; } else { echo '<p>error obtaining shared content folder</p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnectDOM->_xmlrequest) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnectDOM->_xmlresponse) . '</p>'; } $folderscoid = aconnect_get_folder($aconnectDOM, 'forced-archives'); if ($folderscoid) { echo '<p style="color:#006633">successfully obtained forced-archives (meeting recordings) folder scoid: ' . $folderscoid . '</p>'; } else { echo '<p>error obtaining forced-archives (meeting recordings) folder</p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnectDOM->_xmlrequest) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnectDOM->_xmlresponse) . '</p>'; } $folderscoid = aconnect_get_folder($aconnectDOM, 'meetings'); if ($folderscoid) { echo '<p style="color:#006633">successfully obtained meetings folder scoid: ' . $folderscoid . '</p>'; } else { echo '<p>error obtaining meetings folder</p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnectDOM->_xmlrequest) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnectDOM->_xmlresponse) . '</p>'; } //Test creating a meeting $folderscoid = aconnect_get_folder($aconnectDOM, 'meetings'); $meeting = new stdClass(); $meeting->name = 'testmeetingtest'; $time = time(); $meeting->starttime = $time; $time = $time + 60 * 60; $meeting->endtime = $time; if ($meetingscoid = aconnect_create_meeting($aconnectDOM, $meeting, $folderscoid)) { echo '<p style="color:#006633">successfully created meeting <b>testmeetingtest</b> scoid: ' . $meetingscoid . '</p>'; } else { echo '<p>error creating meeting <b>testmeetingtest</b> folder</p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnectDOM->_xmlrequest) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnectDOM->_xmlresponse) . '</p>'; } //Test creating a user $user = new stdClass(); $user->username = '******'; $user->firstname = 'testusertest'; $user->lastname = 'testusertest'; $user->email = '*****@*****.**'; if (!empty($emaillogin)) { $user->username = $user->email; } $skipdeletetest = false; if (!($usrprincipal = aconnect_user_exists($aconnectDOM, $user))) { $usrprincipal = aconnect_create_user($aconnectDOM, $user); if ($usrprincipal) { echo '<p style="color:#006633">successfully created user <b>testusertest</b> principal-id: ' . $usrprincipal . '</p>'; } else { echo '<p>error creating user <b>testusertest</b></p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnectDOM->_xmlrequest) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnectDOM->_xmlresponse) . '</p>'; } } else { echo '<p>user <b>testusertest</b> already exists skipping delete user test</p>'; $skipdeletetest = true; } //Test assigning a user a role to the meeting if (aconnect_check_user_perm($aconnectDOM, $usrprincipal, $meetingscoid, ADOBE_PRESENTER, true)) { echo '<p style="color:#006633">successfully assigned user <b>testusertest</b>' . ' presenter role in meeting <b>testmeetingtest</b>: ' . $usrprincipal . '</p>'; } else { echo '<p>error assigning user <b>testusertest</b> presenter role in meeting <b>testmeetingtest</b></p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnectDOM->_xmlrequest) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnectDOM->_xmlresponse) . '</p>'; } //Test removing role from meeting if (aconnect_check_user_perm($aconnectDOM, $usrprincipal, $meetingscoid, ADOBE_REMOVE_ROLE, true)) { echo '<p style="color:#006633">successfully removed presenter role for user <b>testusertest</b>' . ' in meeting <b>testmeetingtest</b>: ' . $usrprincipal . '</p>'; } else { echo '<p>error remove presenter role for user <b>testusertest</b> in meeting <b>testmeetingtest</b></p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnectDOM->_xmlrequest) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnectDOM->_xmlresponse) . '</p>'; } //Test removing user from server if (!$skipdeletetest) { if (aconnect_delete_user($aconnectDOM, $usrprincipal)) { echo '<p style="color:#006633">successfully removed user <b>testusertest</b> principal-id: ' . $usrprincipal . '</p>'; } else { echo '<p>error removing user <b>testusertest</b></p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnectDOM->_xmlrequest) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnectDOM->_xmlresponse) . '</p>'; } } //Test removing meeting from server if ($meetingscoid) { if (aconnect_remove_meeting($aconnectDOM, $meetingscoid)) { echo '<p style="color:#006633">successfully removed meeting <b>testmeetingtest</b> scoid: ' . $meetingscoid . '</p>'; } else { echo '<p>error removing meeting <b>testmeetingtest</b> folder</p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnectDOM->_xmlrequest) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnectDOM->_xmlresponse) . '</p>'; } } } else { echo '<p style="color:#680000">logging in as ' . $username . ' was not successful, check to see if the username and password are correct </p>'; } } } else { echo '<p style="color:#680000">common-info API call returned an empty document. Please check your settings and try again </p>'; } aconnect_logout($aconnectDOM); }