Beispiel #1
0
 /**
  * @param void $params
  */
 public static function getApplicationsList($params)
 {
     $return = array();
     $appManager = new EyeosApplicationsManager();
     $apps = $appManager->getAllApplications();
     foreach ($apps as $app) {
         $meta = $app->getMeta();
         $sysParams = $meta->get('eyeos.application.systemParameters');
         if ($sysParams['listable'] === 'true') {
             $return[] = $app->getName();
         }
     }
     sort($return);
     return $return;
 }
Beispiel #2
0
 public static function __run(AppExecutionContext $context, MMapResponse $response)
 {
     $currentUser = $context->getProcess()->getLoginContext()->getEyeosUser();
     $groups = UMManager::getInstance()->getAllGroupsByPrincipal($currentUser);
     $isAdmin = 0;
     if ($currentUser->getPrimaryGroupId() == 'eyeID_EyeosGroup_root' || $currentUser->getPrimaryGroupId() == 'eyeID_EyeosGroup_admin') {
         $isAdmin = 1;
     } else {
         foreach ($groups as $group) {
             if ($group->getId() == 'eyeID_EyeosGroup_admin') {
                 $isAdmin = 1;
             }
         }
     }
     $context->getArgs()->offsetSet(0, $isAdmin);
     //get the applications
     $myApplicationsManager = new EyeosApplicationsManager();
     $applications = $myApplicationsManager->getAllApplications();
     $return = array();
     foreach ($applications as $appDesc) {
         $appMeta = $appDesc->getMeta();
         $systemParameters = $appMeta->get('eyeos.application.systemParameters');
         $currentApplicationGroup = 'eyeID_EyeosGroup_' . $systemParameters['group'];
         $currentUserGroup = ProcManager::getInstance()->getCurrentProcess()->getLoginContext()->getEyeosUser()->getPrimaryGroupId();
         if ($currentUserGroup == 'eyeID_EyeosGroup_users' && $currentApplicationGroup == 'eyeID_EyeosGroup_users' || $currentUserGroup != 'eyeID_EyeosGroup_users') {
             $sysParams = $appMeta->get('eyeos.application.systemParameters');
             $imagePath = $appMeta->get('eyeos.application.iconUrl');
             $imageIsValid = true;
             $imagePath = str_replace('48x48', '22x22', $imagePath);
             $imagePath = str_replace('64x64', '22x22', $imagePath);
             try {
                 $file = FSI::getFile($imagePath);
             } catch (Exception $e) {
                 $imageIsValid = false;
             }
             if ($imageIsValid && !$file->isReadable()) {
                 $imageIsValid = false;
             }
             if (!$imageIsValid) {
                 $imagePath = 'sys:///extern/images/22x22/apps/preferences-desktop-default-applications.png';
             }
             $return[] = array('name' => $appDesc->getName(), 'displayName' => $appMeta->get('eyeos.application.name') !== null ? $appMeta->get('eyeos.application.name') : $appDesc->getName(), 'app' => $appDesc->getName(), 'shortDescription' => $appMeta->get('eyeos.application.description'), 'image' => FSI::toExternalUrl($imagePath), 'favorite' => $myApplicationsManager->isApplicationFavorite($appDesc) ? 1 : 0, 'lists' => $appMeta->get('eyeos.application.category'), 'listable' => $sysParams['listable'] == 'true' ? 1 : 0);
         }
     }
     $context->getArgs()->offsetSet(1, $return);
 }
Beispiel #3
0
 /**
  * @param $params array(
  * 		['category' => categoryName]
  * )
  */
 public static function getAllApplications($params)
 {
     $myApplicationsManager = new EyeosApplicationsManager();
     $applications = $myApplicationsManager->getAllApplications();
     $categoryFilter = isset($params['category']) && is_string($params['category']) ? $params['category'] : null;
     $return = array();
     foreach ($applications as $appDesc) {
         $appMeta = $appDesc->getMeta();
         $systemParameters = $appMeta->get('eyeos.application.systemParameters');
         $currentApplicationGroup = 'eyeID_EyeosGroup_' . $systemParameters['group'];
         $currentUserGroup = ProcManager::getInstance()->getCurrentProcess()->getLoginContext()->getEyeosUser()->getPrimaryGroupId();
         // FIXME: must be improved, and better developed...
         if ($currentUserGroup == 'eyeID_EyeosGroup_users') {
             if ($currentUserGroup != $currentApplicationGroup) {
                 continue;
             }
         }
         // Filter on category if requested
         if ($categoryFilter !== null && $appMeta->get('eyeos.application.category') != $categoryFilter) {
             continue;
         }
         $sysParams = $appMeta->get('eyeos.application.systemParameters');
         $imagePath = $appMeta->get('eyeos.application.iconUrl');
         $imageIsValid = true;
         try {
             $file = FSI::getFile($imagePath);
         } catch (Exception $e) {
             $imageIsValid = false;
         }
         if ($imageIsValid && !$file->isReadable()) {
             $imageIsValid = false;
         }
         if (!$imageIsValid) {
             $imagePath = 'sys:///extern/images/48x48/apps/preferences-desktop-default-applications.png';
         }
         $return[] = array('name' => $appDesc->getName(), 'displayName' => $appMeta->get('eyeos.application.name') !== null ? $appMeta->get('eyeos.application.name') : $appDesc->getName(), 'app' => $appDesc->getName(), 'shortDescription' => $appMeta->get('eyeos.application.description'), 'image' => FSI::toExternalUrl($imagePath), 'favorite' => $myApplicationsManager->isApplicationFavorite($appDesc) ? 1 : 0, 'lists' => $appMeta->get('eyeos.application.category'), 'listable' => $sysParams['listable'] == 'true' ? 1 : 0, 'installed' => $myApplicationsManager->isApplicationInstalled($appDesc) ? 1 : 0);
     }
     return $return;
 }