parent
7e9e5db496
commit
c5df58ec69
|
@ -112,11 +112,6 @@ class AppManager implements IAppManager {
|
||||||
return $value !== 'no';
|
return $value !== 'no';
|
||||||
});
|
});
|
||||||
ksort($this->installedAppsCache);
|
ksort($this->installedAppsCache);
|
||||||
foreach ($this->installedAppsCache as $appId => $value) {
|
|
||||||
if (!\OC::$server->getLockdownManager()->canAccessApp($appId)) {
|
|
||||||
unset($this->installedAppsCache[$appId]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $this->installedAppsCache;
|
return $this->installedAppsCache;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,8 +154,7 @@ class DefaultToken extends Entity implements IToken {
|
||||||
$scope = json_decode($this->getScope(), true);
|
$scope = json_decode($this->getScope(), true);
|
||||||
if (!$scope) {
|
if (!$scope) {
|
||||||
return [
|
return [
|
||||||
'filesystem'=> true,
|
'filesystem'=> true
|
||||||
'apps' => []
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return $scope;
|
return $scope;
|
||||||
|
|
|
@ -43,16 +43,4 @@ class LockdownManager implements ILockdownManager {
|
||||||
}
|
}
|
||||||
return !$this->scope || $this->scope['filesystem'];
|
return !$this->scope || $this->scope['filesystem'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canAccessApp($app) {
|
|
||||||
if (!$this->enabled) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if ($this->scope && $this->scope['apps']) {
|
|
||||||
return in_array($app, $this->scope['apps']);
|
|
||||||
} else {
|
|
||||||
// no limit
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ class OC_App {
|
||||||
public static function loadApp($app, $checkUpgrade = true) {
|
public static function loadApp($app, $checkUpgrade = true) {
|
||||||
self::$loadedApps[] = $app;
|
self::$loadedApps[] = $app;
|
||||||
$appPath = self::getAppPath($app);
|
$appPath = self::getAppPath($app);
|
||||||
if($appPath === false || !\OC::$server->getLockdownManager()->canAccessApp($app)) {
|
if($appPath === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,30 @@ namespace OCP\Lockdown;
|
||||||
|
|
||||||
use OC\Authentication\Token\IToken;
|
use OC\Authentication\Token\IToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.2
|
||||||
|
*/
|
||||||
interface ILockdownManager {
|
interface ILockdownManager {
|
||||||
|
/**
|
||||||
|
* Enable the lockdown restrictions
|
||||||
|
*
|
||||||
|
* @since 9.2
|
||||||
|
*/
|
||||||
public function enable();
|
public function enable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the active token to get the restrictions from and enable the lockdown
|
||||||
|
*
|
||||||
|
* @param IToken $token
|
||||||
|
* @since 9.2
|
||||||
|
*/
|
||||||
public function setToken(IToken $token);
|
public function setToken(IToken $token);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether or not filesystem access is allowed
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 9.2
|
||||||
|
*/
|
||||||
public function canAccessFilesystem();
|
public function canAccessFilesystem();
|
||||||
|
|
||||||
public function canAccessApp($app);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue