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

Commit f1af8ff

Browse files
committed
Merge remote-tracking branch 'remote/develop' into develop
2 parents 3014bf4 + f6247b5 commit f1af8ff

File tree

17 files changed

+139
-113
lines changed

17 files changed

+139
-113
lines changed

core/src/core/src/pydio/Core/Http/Dav/AuthBackendDigest.php

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ public function authenticate(Sabre\DAV\Server $server, $realm)
118118
try{
119119
$loggedUser = AuthService::logUser($this->currentUser, null, true);
120120
}catch (LoginException $l){
121-
throw new Sabre\DAV\Exception\NotAuthenticated();
121+
$this->breakNotAuthenticatedAndRequireLogin($server, $realm, $errmsg);
122122
}
123123
$this->updateCurrentUserRights($loggedUser);
124124
} else {
125-
if ($success === false) {
126-
Logger::warning(__CLASS__, "Login failed", array("user" => $this->currentUser, "error" => "Invalid WebDAV user or password"));
127-
}
128-
throw new Sabre\DAV\Exception\NotAuthenticated($errmsg);
125+
if ($success === false) {
126+
Logger::warning(__CLASS__, "Login failed", array("user" => $this->currentUser, "error" => "Invalid WebDAV user or password"));
127+
}
128+
$this->breakNotAuthenticatedAndRequireLogin($server, $realm, $errmsg);
129129
}
130130

131131
if($this->context->hasRepository()){
@@ -159,6 +159,24 @@ public function authenticate(Sabre\DAV\Server $server, $realm)
159159
return true;
160160
}
161161

162+
/**
163+
* @param Sabre\DAV\Server $server
164+
* @param $errmsg
165+
*/
166+
function breakNotAuthenticatedAndRequireLogin(Sabre\DAV\Server $server, $realm, $errmsg){
167+
$digest = new Sabre\HTTP\DigestAuth();
168+
169+
// Hooking up request and response objects
170+
$digest->setHTTPRequest($server->httpRequest);
171+
$digest->setHTTPResponse($server->httpResponse);
172+
173+
$digest->setRealm($realm);
174+
$digest->init();
175+
$digest->requireLogin();
176+
throw new Sabre\DAV\Exception\NotAuthenticated($errmsg);
177+
178+
}
179+
162180
/**
163181
* @param \Pydio\Core\Model\UserInterface $user
164182
* @return bool

core/src/core/src/pydio/Core/Http/Dav/DAVServer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static function handleRoute($baseURI, $davRoute){
101101
}
102102
$server->httpResponse = new DAVResponse();
103103

104-
if((AuthBackendBasic::detectBasicHeader() || ConfService::getGlobalConf("WEBDAV_FORCE_BASIC"))){
104+
if(AuthBackendBasic::detectBasicHeader() || ConfService::getGlobalConf("WEBDAV_FORCE_BASIC")){
105105
$authBackend = new AuthBackendBasic(self::$context);
106106
} else {
107107
$authBackend = new AuthBackendDigest(self::$context);

core/src/core/src/pydio/Core/Http/Middleware/AuthMiddleware.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use Pydio\Core\Model\ContextInterface;
3333
use Pydio\Core\PluginFramework\PluginsService;
3434

35+
use Pydio\Core\Services\AuthService;
3536
use Pydio\Core\Services\ConfService;
3637
use Zend\Diactoros\Response\EmptyResponse;
3738

@@ -68,7 +69,8 @@ public static function handleRequest(\Psr\Http\Message\ServerRequestInterface $r
6869

6970
} catch (NoActiveWorkspaceException $ex){
7071

71-
throw new AuthRequiredException();
72+
AuthService::disconnect();
73+
throw new AuthRequiredException("", $ex->getMessage());
7274

7375
} catch(ActionNotFoundException $a){
7476

core/src/core/src/pydio/Core/Services/AuthService.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public static function disconnect()
164164
CookiesHelper::clearRememberCookie($user);
165165
Logger::info(__CLASS__, "Log Out", "");
166166
SessionService::delete(SessionService::USER_KEY);
167+
SessionService::invalidateLoadedRepositories();
167168
if (ConfService::getContextConf(Context::contextWithObjects($user, null), "SESSION_SET_CREDENTIALS", "auth")) {
168169
MemorySafe::clearCredentials();
169170
}

core/src/core/src/pydio/Core/Services/RolesService.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ public static function updateRole($roleObject, $userObject = null)
146146
{
147147
ConfService::getConfStorageImpl()->updateRole($roleObject, $userObject);
148148
CacheService::saveWithTimestamp(AJXP_CACHE_SERVICE_NS_SHARED, "pydio:role:".$roleObject->getId(), $roleObject);
149+
$profiles = $roleObject->listAutoApplies();
150+
foreach($profiles as $profile){
151+
CacheService::saveWithTimestamp(AJXP_CACHE_SERVICE_NS_SHARED, "pydio:profile:".$profile, time());
152+
}
149153
ConfService::getInstance()->invalidateLoadedRepositories();
150154
$roleId = $roleObject->getId();
151155
if(strpos($roleId, "AJXP_GRP_/") === 0){

core/src/core/src/pydio/Core/Services/UsersService.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ public static function getUserById($userId, $checkExists = true){
8585
// Try to get from cache
8686
$test = CacheService::fetch(AJXP_CACHE_SERVICE_NS_SHARED, "pydio:user:" . $userId);
8787
if($test !== false && $test instanceof UserInterface){
88-
// Second check : if roles were updated in cache
88+
// Second check : if roles were updated in cache, or maybe profile with auto-apply feature
8989
$roleCacheIds = array_map(function($k){ return "pydio:role:".$k; }, $test->getRolesKeys());
90+
$profile = $test->getProfile();
91+
if(!empty($profile)) $roleCacheIds[] = "pydio:profile:".$profile;
9092
$test = CacheService::fetchWithTimestamps(AJXP_CACHE_SERVICE_NS_SHARED, "pydio:user:".$userId, $roleCacheIds);
9193
if($test !== false){
9294
if($test->getPersonalRole() === null){
@@ -180,6 +182,17 @@ public static function getRepositoriesForUser($user, $includeShared = true, $det
180182

181183
}
182184

185+
/**
186+
* @param string $userId
187+
* @param RepositoryInterface[] $repoList
188+
*/
189+
private function setInCache($userId, $repoList){
190+
191+
$this->repositoriesCache[$userId] = $repoList;
192+
SessionService::updateLoadedRepositories($repoList);
193+
194+
}
195+
183196
/**
184197
* @param $userId
185198
* @return mixed|null|\Pydio\Core\Model\RepositoryInterface[]
@@ -203,17 +216,6 @@ private function getFromCaches($userId){
203216

204217
}
205218

206-
/**
207-
* @param string $userId
208-
* @param RepositoryInterface[] $repoList
209-
*/
210-
private function setInCache($userId, $repoList){
211-
212-
$this->repositoriesCache[$userId] = $repoList;
213-
SessionService::updateLoadedRepositories($repoList);
214-
215-
}
216-
217219
public static function invalidateCache(){
218220

219221
self::instance()->repositoriesCache = [];

core/src/plugins/access.ajxp_conf/ajxp_confActions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</processing>
4343
</action>
4444
<action name="edit" fileDefault="true">
45-
<gui text="ajxp_conf.93" title="301" iconClass="icon-edit" src="edit.png" accessKey="edit_access_key" hasAccessKey="true">
45+
<gui text="ajxp_conf.93" title="301" iconClass="mdi mdi-pencil" src="edit.png" accessKey="edit_access_key" hasAccessKey="true">
4646
<context selection="true" dir="" recycle="hidden"
4747
actionBar="true" contextMenu="true" infoPanel="true"
4848
actionBarGroup="get" inZip="false">

core/src/plugins/access.ajxp_conf/src/UsersManager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,7 @@ public function listNodes(ServerRequestInterface $requestInterface, $rootPath, $
864864
$topMeta = $this->serializeGroupMetadata("/", $messages["ajxp_conf.151"]);
865865
$topMeta["icon_class"] = "icon-home";
866866
$rootGroupNode = new AJXP_Node($fullBasePath ."/", $topMeta);
867+
$rootGroupNode->setLeaf(true);
867868
$nodesList->addBranch($rootGroupNode);
868869

869870
}

core/src/plugins/action.scheduler/manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
</processing>
231231
</action>
232232
<action name="scheduler_editTask">
233-
<gui text="action.scheduler.10" title="action.scheduler.11" iconClass="icon-edit" src="scheduler/ICON_SIZE/task.png" hasAccessKey="false">
233+
<gui text="action.scheduler.10" title="action.scheduler.11" iconClass="mdi mdi-pencil" src="scheduler/ICON_SIZE/task.png" hasAccessKey="false">
234234
<context selection="true" dir="" recycle="hidden" allowedMimes="scheduler_zone"
235235
actionBar="true" contextMenu="true" infoPanel="true"
236236
actionBarGroup="get"/>

core/src/plugins/action.share/manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ajxp_plugin name="share" label="CONF_MESSAGE[Sharing Features]" description="CONF_MESSAGE[Share Center actions and hooks]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
33
<server_settings>
44
<global_param name="DISABLE_ALL_SHARING" group="CONF_MESSAGE[Authorizations]" description="CONF_MESSAGE[Disable all sharing on files or folders]" label="CONF_MESSAGE[Disable all sharing]" type="boolean" default="false" expose="false"/>
5-
<global_param name="DISABLE_RESHARING" group="CONF_MESSAGE[Authorizations]" description="CONF_MESSAGE[Disallow all sharing for shared workspaces]" label="CONF_MESSAGE[Disable resharing]" type="boolean" default="false" expose="false"/>
5+
<global_param name="DISABLE_RESHARING" group="CONF_MESSAGE[Authorizations]" description="CONF_MESSAGE[Disallow all sharing for shared workspaces]" label="CONF_MESSAGE[Disable resharing]" type="boolean" default="true" expose="false"/>
66
<global_param name="ENABLE_FILE_PUBLIC_LINK" group="CONF_MESSAGE[Authorizations]" description="CONF_MESSAGE[Allow users to generate public links on files]" label="CONF_MESSAGE[Files: enable public links]" type="boolean" default="true" expose="true"/>
77
<global_param name="ENABLE_FILE_INTERNAL_SHARING" group="CONF_MESSAGE[Authorizations]" description="CONF_MESSAGE[Enable internal file sharing (sharing with users existing or temporary users)]" label="CONF_MESSAGE[Files: enable internal sharing]" type="boolean" mandatory="true" default="true" expose="true"/>
88
<global_param name="ENABLE_FOLDER_PUBLIC_LINK" group="CONF_MESSAGE[Authorizations]" description="CONF_MESSAGE[Allow users to generate public links on folders]" label="CONF_MESSAGE[Folders: enable public links]" type="boolean" default="true" expose="true"/>

0 commit comments

Comments
 (0)