You are here

function farm_api_update_7001 in farmOS 7

Enable the farmOS OAuth2 Server on existing sites.

File

modules/farm/farm_api/farm_api.install, line 81
Farm API install file.

Code

function farm_api_update_7001(&$sandbox) {

  // Install new dependencies.
  $modules = array(
    'oauth2_server',
    'restws_oauth2_server',
  );
  foreach ($modules as $module) {
    if (!module_exists($module)) {
      module_enable(array(
        $module,
      ));
    }
  }

  // Perform the tasks in farm_api_install() as of the time of this writing.
  $permissions = array(
    'use oauth2 server',
  );
  user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, $permissions);
  user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, $permissions);
  $server_name = 'farmos_oauth';
  variable_set('restws_oauth2_server_name', $server_name);
}