/**
  * Check whether sharing is enabled
  * @return bool
  */
 private function isSharingEnabled()
 {
     // FIXME: This check is done here since the route is globally defined and not inside the files_sharing app
     // Check whether the sharing application is enabled
     if (!$this->api->isAppEnabled($this->appName)) {
         return false;
     }
     // Check whether public sharing is enabled
     if ($this->appConfig->getValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
         return false;
     }
     return true;
 }
Example #2
0
 public function testEnableAppForGroups()
 {
     $groups = array(new Group('group1', array(), null), new Group('group2', array(), null));
     $this->expectClearCache();
     $this->manager->enableAppForGroups('test', $groups);
     $this->assertEquals('["group1","group2"]', $this->appConfig->getValue('test', 'enabled', 'no'));
 }
Example #3
0
 /**
  * @dataProvider dataEnableAppForGroupsAllowedTypes
  *
  * @param array $appInfo
  */
 public function testEnableAppForGroupsAllowedTypes(array $appInfo)
 {
     $groups = array(new Group('group1', array(), null), new Group('group2', array(), null));
     $this->expectClearCache();
     /** @var \OC\App\AppManager|\PHPUnit_Framework_MockObject_MockObject $manager */
     $manager = $this->getMockBuilder('OC\\App\\AppManager')->setConstructorArgs([$this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher])->setMethods(['getAppInfo'])->getMock();
     $manager->expects($this->once())->method('getAppInfo')->with('test')->willReturn($appInfo);
     $manager->enableAppForGroups('test', $groups);
     $this->assertEquals('["group1","group2"]', $this->appConfig->getValue('test', 'enabled', 'no'));
 }
Example #4
0
 /**
  * Returns a list of apps that need upgrade
  *
  * @param array $version ownCloud version as array of version components
  * @return array list of app info from apps that need an upgrade
  *
  * @internal
  */
 public function getAppsNeedingUpgrade($ocVersion)
 {
     $appsToUpgrade = [];
     $apps = $this->getInstalledApps();
     foreach ($apps as $appId) {
         $appInfo = $this->getAppInfo($appId);
         $appDbVersion = $this->appConfig->getValue($appId, 'installed_version');
         if ($appDbVersion && isset($appInfo['version']) && version_compare($appInfo['version'], $appDbVersion, '>') && \OC_App::isAppCompatible($ocVersion, $appInfo)) {
             $appsToUpgrade[] = $appInfo;
         }
     }
     return $appsToUpgrade;
 }