You are here

function apps_app_access in Apps 7

Access callback for the operations that can be performed on an app.

2 calls to apps_app_access()
apps_app_enable in ./apps.pages.inc
Callback for the enable action
apps_preprocess_apps_app_teaser in theme/apps.theme.inc
Implements hook_preprocess_apps_app_teaser().
1 string reference to 'apps_app_access'
apps_menu in ./apps.module
Implements hook_menu().

File

./apps.module, line 312
Module file for Apps

Code

function apps_app_access($app, $action = NULL) {
  apps_include('manifest');
  if (user_access('administer apps') && isset($app)) {
    switch ($action) {
      case 'details':
        return TRUE;
      case 'enable':
      case 'install':

        // Don't allow enabling of conflicted a
        foreach (apps_app_find_conflicts($app) as $conflict) {
          if (($conflict_app = apps_app_load($conflict['server'], $conflict['name'])) && $conflict_app['status'] === APPS_ENABLED) {
            return FALSE;
          }
        }
        if ($action == 'enable') {

          // We let enable callback most error conditions when it's next step.
          return isset($_SESSION['apps_install_next']) && $_SESSION['apps_install_next'] == $_GET['q'] || $app['status'] === APPS_DISABLED;
        }
        elseif ($action == 'install') {
          return $app['status'] === APPS_INSTALLABLE;
        }
      case 'update':
        return !empty($app['upgradeable']) || !empty($_SESSION['apps_install_next']) && $_SESSION['apps_install_next'] == apps_app_page_path($app, 'update/updatedb');
      case 'disable':
        return $app['status'] === APPS_ENABLED;
      case 'configure':
        return $app['status'] === APPS_ENABLED && (apps_app_callback($app, "configure form") || apps_app_callback($app, "demo content enabled callback") || apps_app_callback($app, "status callback") || !empty($app['permissions']));
      case 'uninstall':
        return $app['disabled'];
      default:
        return FALSE;
    }
  }
}