本文整理汇总了PHP中Repository::createSession方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::createSession方法的具体用法?PHP Repository::createSession怎么用?PHP Repository::createSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repository
的用法示例。
在下文中一共展示了Repository::createSession方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreateSession
public function testCreateSession()
{
$repository = new Repository();
$ticket = $repository->authenticate("admin", "admin");
$session = $repository->createSession($ticket);
$this->assertNotNull($session);
$this->assertEquals("http://localhost:8080/alfresco/api", $session->repository->connectionUrl);
$this->assertEquals($ticket, $session->ticket);
// TODO for now if no ticket is provided a null session is returned
$session2 = $repository->createSession();
$this->assertNull($session2);
}
示例2: display
function display($tpl = null)
{
// Get the url of the Alfresco repository from the Joosco plugin
// That's why the Joosco plugin needs to be installed and configured before the component
$plugin =& JPluginHelper::getPlugin('authentication', 'joosco');
$pluginParams = new JParameter($plugin->params);
// Here we connect to the Repository
$repositoryUrl = $pluginParams->get('alf-url');
$repository = new Repository($repositoryUrl);
// The ticket is created by the plugin when a user connects
$ticket = $_SESSION["ticket"];
$session = $repository->createSession($ticket);
$store = new SpacesStore($session);
$currentNode = null;
$uuid = null;
$uuid =& JRequest::getVar('uuid');
if (!isset($uuid)) {
$currentNode = $store->companyHome;
$path = 'Company Home';
} else {
$currentNode = $session->getNode($store, JRequest::getVar('uuid'));
$path = JRequest::getVar('path') . '|' . JRequest::getVar('uuid') . '|' . JRequest::getVar('name');
}
// Pass the values to the rest of the template
$this->assignRef('path', $path);
$this->assignRef('session', $session);
$this->assignRef('store', $store);
$this->assignRef('currentNode', $currentNode);
$this->assignRef('option', JRequest::getVar('option'));
$this->assignRef('view', JRequest::getVar('view'));
$this->assignRef('itemid', JRequest::getVar('Itemid'));
parent::display($tpl);
}
示例3: getConnection
protected function getConnection()
{
if ($this->alfresco == null) {
if (!empty($this->alfrescoUrl)) {
$repository = new Repository($this->alfrescoUrl);
try {
$ticket = $repository->authenticate($this->alfrescoUser, $this->alfrescoPass);
} catch (Exception $e) {
za()->log()->err("Failed authenticating to Alfresco");
return;
}
$this->alfresco = $repository->createSession($ticket);
$this->spacesStore = new SpacesStore($this->alfresco);
}
}
return $this->alfresco;
}
示例4: Repository
* Note: any changes to this file should be uploaded to the wiki
*/
// Include the required Alfresco PHP API objects
if (isset($_SERVER["ALF_AVAILABLE"]) == false) {
require_once "Alfresco/Service/Repository.php";
require_once "Alfresco/Service/Session.php";
require_once "Alfresco/Service/SpacesStore.php";
}
// Specify the connection details
$repositoryUrl = "http://localhost:8080/alfresco/api";
$userName = "admin";
$password = "admin";
// Authenticate the user and create a session
$repository = new Repository($repositoryUrl);
$ticket = $repository->authenticate($userName, $password);
$session = $repository->createSession($ticket);
// Create a reference to the 'SpacesStore'
$spacesStore = new SpacesStore($session);
// Use a serach to get the content node we are updating
$nodes = $session->query($spacesStore, "PATH:\"app:company_home/app:guest_home/cm:Alfresco-Tutorial.pdf\"");
$contentNode = $nodes[0];
// Update the property if the form has been posted with the correct details
if (isset($_REQUEST["update"]) == true) {
// Set the updated title and decription values
$contentNode->cm_title = $_REQUEST["title"];
$contentNode->cm_description = $_REQUEST["description"];
// Save the session. This ensures that the updates are presisted back to the repository.
// If this save call is not made the changes made will be lost when the session object is destroyed.
$session->save();
}
?>
示例5: header
// Put the ticket into the session for later use
$_SESSION["alfTicket"] = $alfTicket;
} else {
if (isset($_SESSION["alfTicket"]) == true) {
// Get the ticket out of the session
$alfTicket = $_SESSION["alfTicket"];
}
}
// If we don't have a ticket redirect to the login page somehow
if ($alfTicket == null) {
// Redirect to the login page
header("Location: " . $loginURL);
exit;
}
// Create an alfresco session that can be used
$alfSession = $alfRepository->createSession($alfTicket);
// Create a reference to the media wiki node
if ($alfWikiSpaceNodeRef != null) {
$alfMediaWikiNode = $alfSession->getNodeFromString($alfWikiSpaceNodeRef);
} else {
// Use the default wiki node
$nodes = $alfSession->query(new SpacesStore($alfSession), "TYPE:\"mw:mediaWiki\"");
if (sizeof($nodes) == 0) {
// Redirect to the login page, since we can't find the mediaWiki space (probably means incorrect permissions)
header("Location: " . $loginURL);
exit;
}
$alfMediaWikiNode = $nodes[0];
$alfWikiSpaceNodeRef = $alfMediaWikiNode->__toString();
}
// Validate the ticket (checks you have correct permissions on the wiki space and that the ticket is valid)
示例6: Repository
<?php
$repository = new Repository();
$stores = $repository->createSession()->stores;
?>
<html>
<head>
</head>
<body>
<h1>List of stores</h1>
<ul>
<?php
foreach ($stores as $store) {
echo "<li>" . $store->scheme . "://" . $store->address . "</li>\n";
}
?>
</ul>
</body>
</html>