Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2016-10-19 15:11:58 +02:00
parent 7e9e5db496
commit c5df58ec69
No known key found for this signature in database
GPG Key ID: 425003AC385454C5
5 changed files with 22 additions and 22 deletions

View File

@ -112,11 +112,6 @@ class AppManager implements IAppManager {
return $value !== 'no';
});
ksort($this->installedAppsCache);
foreach ($this->installedAppsCache as $appId => $value) {
if (!\OC::$server->getLockdownManager()->canAccessApp($appId)) {
unset($this->installedAppsCache[$appId]);
}
}
}
return $this->installedAppsCache;
}

View File

@ -154,8 +154,7 @@ class DefaultToken extends Entity implements IToken {
$scope = json_decode($this->getScope(), true);
if (!$scope) {
return [
'filesystem'=> true,
'apps' => []
'filesystem'=> true
];
}
return $scope;

View File

@ -43,16 +43,4 @@ class LockdownManager implements ILockdownManager {
}
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;
}
}
}

View File

@ -140,7 +140,7 @@ class OC_App {
public static function loadApp($app, $checkUpgrade = true) {
self::$loadedApps[] = $app;
$appPath = self::getAppPath($app);
if($appPath === false || !\OC::$server->getLockdownManager()->canAccessApp($app)) {
if($appPath === false) {
return;
}

View File

@ -21,12 +21,30 @@ namespace OCP\Lockdown;
use OC\Authentication\Token\IToken;
/**
* @since 9.2
*/
interface ILockdownManager {
/**
* Enable the lockdown restrictions
*
* @since 9.2
*/
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);
/**
* Check whether or not filesystem access is allowed
*
* @return bool
* @since 9.2
*/
public function canAccessFilesystem();
public function canAccessApp($app);
}