{"cms-login-info"}->server; // The location of the Cascade instance $cascade_user = (string)$xml_config->{"cms-login-info"}->username; // The username to login to the Cascade instance above $cascade_password = (string)$xml_config->{"cms-login-info"}->password; // The username's password $authType = (string)$xml_config->{"authentication-type"}; // The authentication type for importing each user $enableUsers = ((string)$xml_config->{"enable-users"} == 'Yes') ? "true" : "false"; // Whether to enable the imported users or not $xml_feed_path = (string)$xml_config->{"xml-feed"}; // The path to the XML feed relative to the PHP script // Load the XML file holding the information to the users and groups to be imported into the CMS $import_xml = simplexml_load_file($xml_feed_path); // Construct a SOAP client connecting to Cascade instance $client = new SoapClient($cascade_server."/ws/services/AssetOperationService?wsdl", array('trace' => 1)); // Import each group from the XML file foreach($import_xml->group as $group){ importGroup($group); } // Then import each user from the XML file foreach($import_xml->user as $user){ importUser($user); } /** * Import a user into the Cascade instance with the provided SimpleXML Object * containing the user's information. */ function importUser($user) { global $cascade_user, $cascade_password, $authType, $enableUsers, $client; $params = array ( 'authentication' => array ( 'username' => $cascade_user, 'password' => $cascade_password ), 'asset' => array( 'user' => array() ) ); $params['asset']['user']['username'] = (string)$user->username; $params['asset']['user']['fullName'] = (string)$user->fullName; $params['asset']['user']['email'] = (string)$user->email; $params['asset']['user']['authType'] = $authType; $params['asset']['user']['password'] = (string)$user->password; $params['asset']['user']['enabled'] = $enableUsers; $params['asset']['user']['groups'] = (string)$user->groups; if((string)$user->defaultGroup != '') $params['asset']['user']['defaultGroup'] = (string)$user->defaultGroup; $params['asset']['user']['role'] = (string)$user->role; try { $client->create($params); if (substr_count($client->__getLastResponse(), "false") > 0) { print_r($client->__getLastRequest()); print_r($client->__getLastResponse()); //$mesg = $config->get_var("strings.edit_error"); return FALSE; } } catch(Exception $e) { print_r($client->__getLastRequest()); print_r($client->__getLastResponse()); //$mesg = $config->get_var("strings.edit_error"); return FALSE; } /*if($response->editReturn->success != "true") { print_r($client->__getLastRequest()); print_r($client->__getLastResponse()); //$mesg = $config->get_var("strings.edit_error"); return FALSE; }*/ return TRUE; } /** * Import a group into the Cascade instance with the provided SimpleXML Object * containing the group's information. */ function importGroup($group) { global $cascade_user, $cascade_password, $client; $params = array ( 'authentication' => array ( 'username' => $cascade_user, 'password' => $cascade_password ), 'asset' => array ( 'group' => array() ) ); $params['asset']['group']['groupName'] = (string)$group->groupName; if((string)$group->groupStartingPageId != '') $params['asset']['group']['groupStartingPageId'] = (string)$group->groupStartingPageId; elseif((string)$group->groupStartingPagePath != '') $params['asset']['group']['groupStartingPagePath'] = (string)$group->groupStartingPagePath; if((string)$group->groupBaseFolderId != '') $params['asset']['group']['groupBaseFolderId'] = (string)$group->groupBaseFolderId; elseif((string)$group->groupBaseFolderPath != '') $params['asset']['group']['groupBaseFolderPath'] = (string)$group->groupBaseFolderPath; if((string)$group->groupAssetFactoryContainerId != '') $params['asset']['group']['groupAssetFactoryContainerId'] = (string)$group->groupAssetFactoryContainerId; elseif((string)$group->groupAssetFactoryContainerPath != '') $params['asset']['group']['groupAssetFactoryContainerPath'] = (string)$group->groupAssetFactoryContainerPath; if((string)$group->cssClasses != '') $params['asset']['group']['cssClasses'] = (string)$group->cssClasses; if((string)$group->wysiwygAllowFontAssignment != '') $params['asset']['group']['wysiwygAllowFontAssignment'] = (strtolower((string)$group->wysiwygAllowFontAssignment) == 'true') ? "true" : "false"; if((string)$group->wysiwygAllowFontFormatting != '') $params['asset']['group']['wysiwygAllowFontFormatting'] = (strtolower((string)$group->wysiwygAllowFontFormatting) == 'true') ? "true" : "false"; if((string)$group->wysiwygAllowTextFormatting != '') $params['asset']['group']['wysiwygAllowTextFormatting'] = (strtolower((string)$group->wysiwygAllowTextFormatting) == 'true') ? "true" : "false"; if((string)$group->wysiwygAllowViewSource != '') $params['asset']['group']['wysiwygAllowViewSource'] = (strtolower((string)$group->wysiwygAllowViewSource) == 'true') ? "true" : "false"; if((string)$group->wysiwygAllowImageInsertion != '') $params['asset']['group']['wysiwygAllowImageInsertion'] = (strtolower((string)$group->wysiwygAllowImageInsertion) == 'true') ? "true" : "false"; if((string)$group->wysiwygAllowTableInsertion != '') $params['asset']['group']['wysiwygAllowTableInsertion'] = (strtolower((string)$group->wysiwygAllowTableInsertion) == 'true') ? "true" : "false"; $params['asset']['group']['role'] = (string)$group->role; try { $client->create($params); if (substr_count($client->__getLastResponse(), "false") > 0) { print_r($client->__getLastRequest()); print_r($client->__getLastResponse()); //$mesg = $config->get_var("strings.edit_error"); return FALSE; } } catch(Exception $e) { print_r($client->__getLastRequest()); print_r($client->__getLastResponse()); //$mesg = $config->get_var("strings.edit_error"); return FALSE; } /*if($response->editReturn->success != "true") { print_r($client->__getLastRequest()); print_r($client->__getLastResponse()); //$mesg = $config->get_var("strings.edit_error"); return FALSE; }*/ return TRUE; } echo "Done."; ?>