Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Docs and unused codes
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Jun 5, 2016
1 parent b049072 commit 6cd0506
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 33 deletions.
Expand Up @@ -40,7 +40,7 @@ public function __construct($repository, $errors)
{
$message = "Error while loading workspace ".$repository->getDisplay()." : ".implode("\n-", $errors);
$this->repository = $repository;
parent::__construct($message, null, 5000);
parent::__construct($message, false, 5000);
}

public function getRepository(){
Expand Down
7 changes: 3 additions & 4 deletions core/src/core/src/pydio/Core/PluginFramework/Plugin.php
Expand Up @@ -21,11 +21,10 @@
namespace Pydio\Core\PluginFramework;

use Pydio\Access\Core\AJXP_MetaStreamWrapper;
use Pydio\Access\Core\Model\Repository;
use Pydio\Core\Model\Context;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Model\RepositoryInterface;
use Pydio\Core\Services\AuthService;
use Pydio\Core\PluginFramework\PluginsService;
use Pydio\Core\Services\ConfService;
use Pydio\Core\Controller\XMLWriter;
use Pydio\Log\Core\AJXP_Logger;
Expand Down Expand Up @@ -170,7 +169,7 @@ protected function getContextualOption(ContextInterface $ctx, $optionName){

/**
* @param string $optionName
* @param string|\Pydio\Access\Core\Model\Repository $repositoryScope
* @param string|RepositoryInterface $repositoryScope
* @param null|\Pydio\Conf\Core\AbstractAjxpUser $userObject
* @return mixed|null
*/
Expand All @@ -187,7 +186,7 @@ protected function getFilteredOption($optionName, $repositoryScope = AJXP_REPO_S
if ($repositoryScope === AJXP_REPO_SCOPE_ALL) {
$repo = ConfService::getRepository();
if($repo != null) $repositoryScope = $repo->getId();
}else if(is_object($repositoryScope) && $repositoryScope instanceof Repository){
}else if(is_object($repositoryScope) && $repositoryScope instanceof RepositoryInterface){
$repo = $repositoryScope;
$repositoryScope = $repo->getId();
}
Expand Down
11 changes: 6 additions & 5 deletions core/src/core/src/pydio/Core/PluginFramework/PluginsService.php
Expand Up @@ -862,7 +862,7 @@ public function patchPluginWithMixin(&$plugin, &$manifestDoc, $mixinName)
/*********************************/
/**
* Save plugin registry to cache
* @param AbstractCacheDriver $cacheStorage
* @param AbstractCacheDriver|null $cacheStorage
*/
private function savePluginsRegistryToCache($cacheStorage) {
if (!empty ($cacheStorage)) {
Expand Down Expand Up @@ -957,8 +957,9 @@ private function _loadDetectedPluginsFromCache($cacheStorage){
// Retrieving Registry from Server Cache
if (!empty($cacheStorage)) {
$res = $cacheStorage->fetch(AJXP_CACHE_SERVICE_NS_SHARED, 'plugins_registry');

$this->detectedPlugins=$res;
if(is_array($res)){
$this->detectedPlugins=$res;
}
}

// Retrieving Registry from files cache
Expand Down Expand Up @@ -1100,7 +1101,7 @@ private function filterRegistryFromRole(&$registry, ContextInterface $ctx)
if ($crtRepo != null && $crtRepo instanceof Repository) {
$crtRepoId = $crtRepo->getId();
}
$actionRights = $loggedUser->mergedRole->listActionsStatesFor($crtRepo);
$actionRights = $loggedUser->getMergedRole()->listActionsStatesFor($crtRepo);
$changes = false;
$xPath = new DOMXPath($registry);
foreach ($actionRights as $pluginName => $actions) {
Expand All @@ -1115,7 +1116,7 @@ private function filterRegistryFromRole(&$registry, ContextInterface $ctx)
$changes = true;
}
}
$parameters = $loggedUser->mergedRole->listParameters();
$parameters = $loggedUser->getMergedRole()->listParameters();
foreach ($parameters as $scope => $paramsPlugs) {
if ($scope === AJXP_REPO_SCOPE_ALL || $scope === $crtRepoId || ($crtRepo != null && $crtRepo->hasParent() && $scope === AJXP_REPO_SCOPE_SHARED)) {
foreach ($paramsPlugs as $plugId => $params) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Core/Services/ConfService.php
Expand Up @@ -1548,7 +1548,7 @@ private function loadRepositoryDriverInst(&$repository)
}

/**
* @param Repository $repository
* @param RepositoryInterface $repository
*/
public static function switchBackAfterRepositoryError($repository){
self::getInstance()->removeRepositoryFromCache($repository->getId());
Expand Down
Expand Up @@ -675,7 +675,7 @@ public function switchAction($action, $httpVars, $fileVars, ContextInterface $ct
if(!AuthService::canAdministrate($userObject)){
throw new \Exception("Cant find user!");
}
$role = $userObject->personalRole;
$role = $userObject->getPersonalRole();
} else {
$role = AuthService::getRole($roleId, $roleGroup);
}
Expand Down Expand Up @@ -858,7 +858,7 @@ public function switchAction($action, $httpVars, $fileVars, ContextInterface $ct
if(!AuthService::canAdministrate($userObject)){
throw new \Exception("Cannot post role for user ".$usrId);
}
$originalRole = $userObject->personalRole;
$originalRole = $userObject->getPersonalRole();
} else {
// second param = create if not exists.
$originalRole = AuthService::getRole($roleId, $roleGroup);
Expand Down Expand Up @@ -1082,7 +1082,7 @@ public function switchAction($action, $httpVars, $fileVars, ContextInterface $ct
if(!AuthService::canAdministrate($user)){
throw new \Exception("Cannot update user with id ".$userId);
}
$user->personalRole->setAcl(Utils::sanitize($httpVars["repository_id"], AJXP_SANITIZE_ALPHANUM), Utils::sanitize($httpVars["right"], AJXP_SANITIZE_ALPHANUM));
$user->getPersonalRole()->setAcl(Utils::sanitize($httpVars["repository_id"], AJXP_SANITIZE_ALPHANUM), Utils::sanitize($httpVars["right"], AJXP_SANITIZE_ALPHANUM));
$user->save();
$loggedUser = $ctx->getUser();
if ($loggedUser->getId() == $user->getId()) {
Expand Down Expand Up @@ -1536,7 +1536,7 @@ public function switchAction($action, $httpVars, $fileVars, ContextInterface $ct
$groupRole->setAcl($newRep->getId(), $defaultRights);
}
$loggedUser = $ctx->getUser();
$loggedUser->personalRole->setAcl($newRep->getUniqueId(), "rw");
$loggedUser->getPersonalRole()->setAcl($newRep->getUniqueId(), "rw");
$loggedUser->recomputeMergedRole();
$loggedUser->save("superuser");
AuthService::updateUser($loggedUser);
Expand Down
2 changes: 0 additions & 2 deletions core/src/plugins/access.fs/class.fsAccessDriver.php
Expand Up @@ -356,8 +356,6 @@ public function createResourceAction(ServerRequestInterface &$request, ResponseI
*/
public function uploadAction(ServerRequestInterface &$request, ResponseInterface &$response){

/** @var ContextInterface $ctx */
$ctx = $request->getAttribute("ctx");
$selection = new UserSelection($this->repository);
$httpVars = $request->getParsedBody();
$dir = Utils::sanitize($httpVars["dir"], AJXP_SANITIZE_DIRNAME) OR "";
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/action.scheduler/class.AjxpScheduler.php
Expand Up @@ -545,7 +545,7 @@ public function handleTasks($action, $httpVars, $fileVars)
public function fakeLongTask($action, $httpVars, $fileVars, \Pydio\Core\Model\ContextInterface $context)
{
$minutes = (isSet($httpVars["time_length"])?intval($httpVars["time_length"]):2);
$this->logInfo(__FUNCTION__, "Running Fake task on ".$context->getId());
$this->logInfo(__FUNCTION__, "Running Fake task on ".$context->getRepositoryId());
print('STARTING FAKE TASK');
sleep($minutes * 30);
print('ENDIND FAKE TASK');
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/action.share/src/ShareCenter.php
Expand Up @@ -1662,7 +1662,7 @@ public function shareNode(ContextInterface $ctx, $ajxpNode, $httpVars, &$update)
return null;
}

$newRepo = $this->createSharedRepository($httpVars, $repoUpdate, $users, $groups);
$newRepo = $this->createSharedRepository($httpVars, $update, $users, $groups);

foreach($shareObjects as $shareObject){

Expand Down
23 changes: 13 additions & 10 deletions core/src/plugins/core.conf/class.AbstractConfDriver.php
Expand Up @@ -408,7 +408,7 @@ public function createUserObject($userId)
{
$test=CacheService::fetch("shared", "pydio:user:" . $userId);
if($test !== false && $test instanceof AbstractAjxpUser){
if($test->personalRole == null){
if($test->getPersonalRole() === null){
$test->personalRole = $test->roles["AJXP_USR_/".$userId];
}
$test->recomputeMergedRole();
Expand Down Expand Up @@ -806,7 +806,6 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI

} else {
$updating = false;
$loggedUser = $loggedUser;
Utils::parseStandardFormParameters($httpVars, $data, null, "PREFERENCES_");
}

Expand All @@ -823,18 +822,22 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI
$name = $xmlNode->getAttribute("name");
if (isSet($data[$name]) || $data[$name] === "") {
if($data[$name] == "__AJXP_VALUE_SET__") continue;
if ($data[$name] === "" || $loggedUser->parentRole == null
|| $loggedUser->parentRole->filterParameterValue($pluginId, $name, AJXP_REPO_SCOPE_ALL, "") != $data[$name]
|| $loggedUser->personalRole->filterParameterValue($pluginId, $name, AJXP_REPO_SCOPE_ALL, "") != $data[$name]) {
$loggedUser->personalRole->setParameterValue($pluginId, $name, $data[$name]);
$pRole = null;
$persRole = $loggedUser->getPersonalRole();
if($loggedUser instanceof AbstractAjxpUser) $pRole = $loggedUser->parentRole;
if ($data[$name] === ""
|| $pRole === null || $pRole->filterParameterValue($pluginId, $name, AJXP_REPO_SCOPE_ALL, "") != $data[$name]
|| $persRole->filterParameterValue($pluginId, $name, AJXP_REPO_SCOPE_ALL, "") != $data[$name])
{
$persRole->setParameterValue($pluginId, $name, $data[$name]);
$rChanges = true;
}
}
}
}
}
if ($rChanges) {
AuthService::updateRole($loggedUser->personalRole, $loggedUser);
AuthService::updateRole($loggedUser->getPersonalRole(), $loggedUser);
$loggedUser->recomputeMergedRole();
if ($action == "custom_data_edit") {
AuthService::updateUser($loggedUser);
Expand Down Expand Up @@ -886,7 +889,7 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI
$result = array();
$params = explode(",", $paramsString);
foreach($params as $p){
$result[$p] = $loggedUser->personalRole->filterParameterValue("core.conf", $p, AJXP_REPO_SCOPE_ALL, "");
$result[$p] = $loggedUser->getPersonalRole()->filterParameterValue("core.conf", $p, AJXP_REPO_SCOPE_ALL, "");
}

$responseInterface = $responseInterface->withHeader("Content-type", "application/json");
Expand Down Expand Up @@ -1051,7 +1054,7 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI

// Make sure we do not overwrite otherwise loaded rights.
$loggedUser->load();
$loggedUser->personalRole->setAcl($newRep->getUniqueId(), "rw");
$loggedUser->getPersonalRole()->setAcl($newRep->getUniqueId(), "rw");
$loggedUser->save("superuser");
$loggedUser->recomputeMergedRole();
AuthService::updateUser($loggedUser);
Expand Down Expand Up @@ -1079,7 +1082,7 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI

// Make sure we do not override remotely set rights
$loggedUser->load();
$loggedUser->personalRole->setAcl($repoId, "");
$loggedUser->getPersonalRole()->setAcl($repoId, "");
$loggedUser->save("superuser");
AuthService::updateUser($loggedUser);

Expand Down
7 changes: 4 additions & 3 deletions core/src/plugins/core.log/class.AJXP_Logger.php
Expand Up @@ -45,6 +45,9 @@ class AJXP_Logger extends Plugin
* @var AbstractLogDriver
*/
protected $pluginInstance;
/**
* @var AbstractLogDriver
*/
protected static $loggerInstance;
protected static $globalOptions;

Expand All @@ -71,7 +74,6 @@ public function getLoggerInstance()
* @param string $source The source of the message (plugin id or classname)
* @param string $prefix A quick description
* @param array $messages An array of messages (string or array).
* @param array $nodePathes Optional array of pathes
*/
public static function log2($level, $source, $prefix, $messages = array())
{
Expand Down Expand Up @@ -122,7 +124,6 @@ public static function log2($level, $source, $prefix, $messages = array())
* @static
* @param string $source The source of the message (plugin id or classname)
* @param string $prefix A quick description
* @param string|array $messages Variable number of message args (string or array).
* @return void
*/
public static function debug($source, $prefix = "")
Expand Down Expand Up @@ -267,7 +268,7 @@ public static function getLoggedUser()
/**
* Format an array as a readable string
*
* @param Array $params
* @param array $params
* @return String readable list of parameters.
*/
public static function arrayToString($params)
Expand Down
1 change: 0 additions & 1 deletion core/src/plugins/meta.watch/class.MetaWatchRegister.php
Expand Up @@ -372,7 +372,6 @@ public function switchActions(\Psr\Http\Message\ServerRequestInterface $requestI
if($actionName !== "toggle_watch") return;
/** @var ContextInterface $ctx */
$ctx = $requestInterface->getAttribute("ctx");
$ctxUser = $ctx->getUser();

$us = new UserSelection($this->accessDriver->repository, $httpVars);
$node = $us->getUniqueNode();
Expand Down

0 comments on commit 6cd0506

Please sign in to comment.