diff --git a/payment/uc_authorizenet/uc_authorizenet.module b/payment/uc_authorizenet/uc_authorizenet.module
index b617f57..efb92ed 100644
--- a/payment/uc_authorizenet/uc_authorizenet.module
+++ b/payment/uc_authorizenet/uc_authorizenet.module
@@ -170,7 +170,7 @@ function uc_authorizenet_settings_form($form, &$form_state) {
     '#title' => t('MD5 Hash'),
     '#description' => t('<b>Note:</b> You must first configure credit card encryption before setting this.<br />Enter the value here you entered in your Auth.Net account settings.'),
     '#default_value' => $login_data['md5_hash'],
-    '#access' => user_access('administer credit cards'),
+    '#access' => \Drupal::currentUser()->hasPermission('administer credit cards'),
   );
   $form['arb_settings']['uc_authnet_report_arb_post'] = array(
     '#type' => 'checkbox',
diff --git a/payment/uc_credit/uc_credit.admin.inc b/payment/uc_credit/uc_credit.admin.inc
index 87dc18f..961faa6 100644
--- a/payment/uc_credit/uc_credit.admin.inc
+++ b/payment/uc_credit/uc_credit.admin.inc
@@ -12,7 +12,8 @@
  * @see uc_credit_settings_form_submit()
  */
 function uc_credit_settings_form($form, &$form_state) {
-  if (!user_access('administer credit cards')) {
+  $account = \Drupal::currentUser();
+  if (!$account->hasPermission('administer credit cards')) {
     $form['notice'] = array(
       '#markup' => '<div>' . t('You must have access to <b>administer credit cards</b> to adjust these settings.') . '</div>',
     );
diff --git a/payment/uc_credit/uc_credit.module b/payment/uc_credit/uc_credit.module
index cd9b2e3..afac5b8 100644
--- a/payment/uc_credit/uc_credit.module
+++ b/payment/uc_credit/uc_credit.module
@@ -437,7 +437,8 @@ function uc_payment_method_credit($op, &$order, $form = NULL, &$form_state = NUL
       $build = array();
 
       // Add the hidden span for the CC details if possible.
-      if (user_access('view cc details')) {
+      $account = \Drupal::currentUser();
+      if ($account->hasPermission('view cc details')) {
         $rows = array();
 
         if (!empty($order->payment_details['cc_type'])) {
@@ -475,7 +476,7 @@ function uc_payment_method_credit($op, &$order, $form = NULL, &$form_state = NUL
         );
 
         // Add the form to process the card if applicable.
-        if (user_access('process credit cards')) {
+        if ($account->hasPermission('process credit cards')) {
           $build['terminal'] = drupal_get_form('uc_credit_order_view_form', $order->id());
         }
       }
diff --git a/payment/uc_payment/lib/Drupal/uc_payment/Form/OrderPaymentsForm.php b/payment/uc_payment/lib/Drupal/uc_payment/Form/OrderPaymentsForm.php
index bdd4fa7..28e8472 100644
--- a/payment/uc_payment/lib/Drupal/uc_payment/Form/OrderPaymentsForm.php
+++ b/payment/uc_payment/lib/Drupal/uc_payment/Form/OrderPaymentsForm.php
@@ -51,6 +51,7 @@ class OrderPaymentsForm extends FormBase {
       '#weight' => 10,
     );
 
+    $account = \Drupal::currentUser();
     if ($payments !== FALSE) {
       foreach ($payments as $payment) {
         $form['payments'][$payment->receipt_id]['received'] = array(
@@ -74,7 +75,7 @@ class OrderPaymentsForm extends FormBase {
         $form['payments'][$payment->receipt_id]['comment'] = array(
           '#markup' => ($payment->comment == '') ? '-' : filter_xss_admin($payment->comment),
         );
-        if (user_access('delete payments')) {
+        if ($account->hasPermission('delete payments')) {
           $action_value = l(t('Delete'), 'admin/store/orders/' . $this->order->id() . '/payments/'
                             . $payment->receipt_id . '/delete');
         }
@@ -94,7 +95,7 @@ class OrderPaymentsForm extends FormBase {
       '#price' => $total,
     );
 
-    if (user_access('manual payments')) {
+    if ($account->hasPermission('manual payments')) {
       $form['payments']['new']['received'] = array(
         '#type' => 'date',
         '#default_value' => array(
diff --git a/payment/uc_payment/uc_payment.module b/payment/uc_payment/uc_payment.module
index 205a847..739f224 100644
--- a/payment/uc_payment/uc_payment.module
+++ b/payment/uc_payment/uc_payment.module
@@ -318,7 +318,8 @@ function uc_payment_process_payment($method, $order_id, $amount, $data = NULL, $
     // Otherwise display an error message to administrators.
     $result['success'] = FALSE;
     $result['message'] = t('An error has occurred with your payment gateway. The charge function could not be found.');
-    if (user_access('administer store')) {
+    $account = \Drupal::currentUser();
+    if ($account->hasPermission('administer store')) {
       drupal_set_message($result['message']);
     }
   }
diff --git a/payment/uc_payment/uc_payment_order_pane.inc b/payment/uc_payment/uc_payment_order_pane.inc
index 3c73f5b..8474d81 100644
--- a/payment/uc_payment/uc_payment_order_pane.inc
+++ b/payment/uc_payment/uc_payment_order_pane.inc
@@ -23,7 +23,8 @@ function uc_order_pane_payment($op, $order, &$form = NULL, &$form_state = NULL)
     case 'view':
       $build['balance'] = array('#markup' => t('Balance: @balance', array('@balance' => uc_currency_format(uc_payment_balance($order)))));
 
-      if (user_access('view payments')) {
+      $account = \Drupal::currentUser();
+      if ($account->hasPermission('view payments')) {
         $build['view_payments'] = array(
           '#markup' => ' (' . l(t('View'), 'admin/store/orders/' . $order->id() . '/payments') . ')',
         );
diff --git a/shipping/uc_shipping/lib/Drupal/uc_shipping/Plugin/views/field/ShipmentId.php b/shipping/uc_shipping/lib/Drupal/uc_shipping/Plugin/views/field/ShipmentId.php
index 6e4fb4e..2a5b075 100644
--- a/shipping/uc_shipping/lib/Drupal/uc_shipping/Plugin/views/field/ShipmentId.php
+++ b/shipping/uc_shipping/lib/Drupal/uc_shipping/Plugin/views/field/ShipmentId.php
@@ -62,7 +62,7 @@ class ShipmentId extends FieldPluginBase {
     if (!empty($this->options['link_to_shipment'])) {
       $this->options['alter']['make_link'] = FALSE;
 
-      if (user_access('fulfill orders')) {
+      if (\Drupal::currentUser()->hasPermission('fulfill orders')) {
         $path = 'admin/store/orders/' . $this->get_value($values, 'order_id') . '/shipments/' . $values->{$this->field_alias};
       }
       else {
diff --git a/shipping/uc_shipping/uc_shipping.module b/shipping/uc_shipping/uc_shipping.module
index 2fd2c0a..47608bc 100644
--- a/shipping/uc_shipping/uc_shipping.module
+++ b/shipping/uc_shipping/uc_shipping.module
@@ -159,7 +159,8 @@ function uc_shipping_shipment_page_title($shipment) {
  * Ensures access to the Shipments tab.
  */
 function uc_shipping_order_access($order) {
-  return user_access('fulfill orders') && $order->isShippable();
+  $account = \Drupal::currentUser();
+  return $account->hasPermission('fulfill orders') && $order->isShippable();
 }
 
 /**
@@ -312,7 +313,8 @@ function uc_shipping_uc_order_pane() {
  */
 function uc_shipping_uc_order_actions($order) {
   $actions = array();
-  if (user_access('fulfill orders')) {
+  $account = \Drupal::currentUser();
+  if ($account->hasPermission('fulfill orders')) {
     $result = db_query("SELECT COUNT(nid) FROM {uc_order_products} WHERE order_id = :id AND data LIKE :data", array(':id' => $order->id(), ':data' => '%s:9:\"shippable\";s:1:\"1\";%'));
     if ($result->fetchField()) {
       $actions['package'] = array(
diff --git a/shipping/uc_ups/config/uc_ups.settings.yml b/shipping/uc_ups/config/uc_ups.settings.yml
index 86cd1e2..bdeb9a0 100644
--- a/shipping/uc_ups/config/uc_ups.settings.yml
+++ b/shipping/uc_ups/config/uc_ups.settings.yml
@@ -23,7 +23,7 @@ negotiated_rates: 0
 residential_quotes: 0
 all_in_one: 1
 unit_system: ""
-insurance: TRUE
+insurance: true
 rate_markup_type: 'percentage'
 rate_markup: 0
 weight_markup_type: 'percentage'
diff --git a/shipping/uc_ups/uc_ups.module b/shipping/uc_ups/uc_ups.module
index c822686..23c9bdb 100644
--- a/shipping/uc_ups/uc_ups.module
+++ b/shipping/uc_ups/uc_ups.module
@@ -289,13 +289,13 @@ function uc_ups_uc_shipping_method() {
 function uc_ups_uc_store_status() {
   $messages = array();
 
-  $ups_config = \Drupal::config('uc_ups.settings');
-  $access   = $ups_config->get('access_license') != '';
-  $account  = $ups_config->get('shipper_number') != '';
-  $user     = $ups_config->get('user_id') != '';
-  $password = $ups_config->get('password') != '';
+  $ups_config  = \Drupal::config('uc_ups.settings');
+  $access      = $ups_config->get('access_license') != '';
+  $ups_account = $ups_config->get('shipper_number') != '';
+  $user        = $ups_config->get('user_id') != '';
+  $password    = $ups_config->get('password') != '';
 
-  if ($access && $account && $user && $password) {
+  if ($access && $ups_account && $user && $password) {
     $messages[] = array(
       'status' => 'ok',
       'title' => t('UPS Online Tools'),
@@ -352,7 +352,6 @@ function uc_ups_access_request() {
  */
 function uc_ups_shipping_quote($packages, $origin, $destination, $ups_service) {
   $ups_config = \Drupal::config('uc_ups.settings');
-  $account = $ups_config->get('shipper_number');
   $ua = explode(' ', $_SERVER['HTTP_USER_AGENT']);
   $user_agent = $ua[0];
 
@@ -713,7 +712,8 @@ function uc_ups_quote($products, $details, $method) {
       $resp = \Drupal::httpClient()
         ->post($ups_config->get('connection_address') . 'Rate', NULL, $request)
         ->send();
-      if (user_access('configure quotes') && $ups_config->get('uc_quote_display_debug')) {
+      $account = \Drupal::currentUser();
+      if ($account->hasPermission('configure quotes') && $ups_config->get('uc_quote_display_debug')) {
         if (!isset($debug_data[$ups_service]['debug'])) {
           $debug_data[$ups_service]['debug'] = '';
         }
@@ -722,7 +722,7 @@ function uc_ups_quote($products, $details, $method) {
       $response = new SimpleXMLElement($resp->getBody(TRUE));
       if (isset($response->Response->Error)) {
         foreach ($response->Response->Error as $error) {
-          if (user_access('configure quotes') && $ups_config->get('uc_quote_display_debug')) {
+          if ($account->hasPermission('configure quotes') && $ups_config->get('uc_quote_display_debug')) {
             $debug_data[$ups_service]['error'][] = (string)$error->ErrorSeverity . ' ' . (string)$error->ErrorCode . ': ' . (string)$error->ErrorDescription;
           }
           if (strpos((string)$error->ErrorSeverity, 'Hard') !== FALSE) {
diff --git a/shipping/uc_usps/uc_usps.module b/shipping/uc_usps/uc_usps.module
index 353aab1..9eb5ded 100644
--- a/shipping/uc_usps/uc_usps.module
+++ b/shipping/uc_usps/uc_usps.module
@@ -312,7 +312,8 @@ function uc_usps_quote($products, $details, $method) {
       $request = uc_usps_rate_request($ship_packages, $orig, $destination);
     }
 
-    if (user_access('configure quotes') && $quote_config->get('display_debug')) {
+    $account = \Drupal::currentUser();
+    if ($account->hasPermission('configure quotes') && $quote_config->get('display_debug')) {
       $debug_data['debug'] .= htmlentities(urldecode($request)) . "<br />\n";
     }
 
@@ -321,7 +322,7 @@ function uc_usps_quote($products, $details, $method) {
       ->post($connection_url, NULL, $request)
       ->send();
 
-    if (user_access('configure quotes') && $quote_config->get('display_debug')) {
+    if ($account->hasPermission('configure quotes') && $quote_config->get('display_debug')) {
       $debug_data['debug'] .= htmlentities($result->getBody(TRUE)) . "<br />\n";
     }
 
diff --git a/uc_cart/lib/Drupal/uc_cart/Plugin/Block/CartBlock.php b/uc_cart/lib/Drupal/uc_cart/Plugin/Block/CartBlock.php
index 8e7841d..a155174 100644
--- a/uc_cart/lib/Drupal/uc_cart/Plugin/Block/CartBlock.php
+++ b/uc_cart/lib/Drupal/uc_cart/Plugin/Block/CartBlock.php
@@ -35,7 +35,7 @@ class CartBlock extends BlockBase {
    * Overrides \Drupal\block\BlockBase::access().
    */
   public function blockAccess() {
-    return user_access('access content');
+    return \Drupal::currentUser()->hasPermission('access content');
   }
 
   /**
diff --git a/uc_cart_links/uc_cart_links.module b/uc_cart_links/uc_cart_links.module
index c1943a5..d118bcb 100644
--- a/uc_cart_links/uc_cart_links.module
+++ b/uc_cart_links/uc_cart_links.module
@@ -61,7 +61,7 @@ function uc_cart_links_permission() {
  * Implements hook_uc_add_to_cart().
  */
 function uc_cart_links_uc_add_to_cart($nid, $qty, $data) {
-  if (user_access('administer cart links') &&
+  if (\Drupal::currentUser()->hasPermission('administer cart links') &&
       \Drupal::config('uc_cart_links.settings')->get('add_show')) {
     $cart_link = 'p' . $nid . '_q' . $qty;
     if (!empty($data['attributes'])) {
diff --git a/uc_catalog/lib/Drupal/uc_catalog/Plugin/Block/CatalogBlock.php b/uc_catalog/lib/Drupal/uc_catalog/Plugin/Block/CatalogBlock.php
index 1903301..4369fdb 100644
--- a/uc_catalog/lib/Drupal/uc_catalog/Plugin/Block/CatalogBlock.php
+++ b/uc_catalog/lib/Drupal/uc_catalog/Plugin/Block/CatalogBlock.php
@@ -40,7 +40,7 @@ class CatalogBlock extends BlockBase {
    * {@inheritdoc}
    */
   public function blockAccess() {
-    return user_access('view catalog');
+    return \Drupal::currentUser()->hasPermission('view catalog');
   }
 
   /**
diff --git a/uc_file/uc_file.module b/uc_file/uc_file.module
index 1ac2ad8..1f1cfea 100644
--- a/uc_file/uc_file.module
+++ b/uc_file/uc_file.module
@@ -73,8 +73,8 @@ function uc_file_menu() {
  * Access callback for a user's list of purchased file downloads.
  */
 function uc_file_user_access($account) {
-  global $user;
-  return $user->id() && (user_access('view all downloads') || $user->id() == $account->id());
+  $user = \Drupal::currentUser();
+  return $user->id() && ($user-hasPermission('view all downloads') || $user->id() == $account->id());
 }
 
 /**
@@ -362,12 +362,12 @@ function uc_file_user_form_submit($form, &$form_state) {
  * Implements hook_user_view().
  */
 function uc_file_user_view($account, $view_mode) {
-  global $user;
+  $user = \Drupal::currentUser();
 
   // If user has files and permission to view them, put a link
   // on the user's profile.
   $existing_download = db_query("SELECT fid FROM {uc_file_users} WHERE uid = :uid", array(':uid' => $account->id()))->fetchField();
-  if ($view_mode != 'full' || !$existing_download || (!user_access('view all downloads') && $user->id() != $account->id())) {
+  if ($view_mode != 'full' || !$existing_download || (!$user->hasPermission('view all downloads') && $user->id() != $account->id())) {
     return;
   }
 
diff --git a/uc_file/uc_file.pages.inc b/uc_file/uc_file.pages.inc
index 08fb430..e3708ed 100644
--- a/uc_file/uc_file.pages.inc
+++ b/uc_file/uc_file.pages.inc
@@ -171,7 +171,7 @@ function uc_file_user_downloads($account) {
     '#files' => $files,
   );
 
-  if (user_access('administer users')) {
+  if (\Drupal::currentUser()->hasPermission('administer users')) {
     $build['admin'] = drupal_get_form('uc_file_user_form', $account);
   }
 
@@ -189,7 +189,7 @@ function uc_file_user_downloads($account) {
  * @see _uc_file_download_validate()
  */
 function _uc_file_download($fid) {
-  global $user;
+  $user = \Drupal::currentUser();
 
   // Error messages for various failed download states.
   $admin_message = t('Please contact the site administrator if this message has been received in error.');
@@ -204,7 +204,7 @@ function _uc_file_download($fid) {
   );
 
   $ip = Drupal::request()->getClientIp();
-  if (user_access('view all downloads')) {
+  if ($user->hasPermission('view all downloads')) {
     $file_download = uc_file_get_by_id($fid);
   }
   else {
@@ -220,7 +220,7 @@ function _uc_file_download($fid) {
 
   // If it's ok, we push the file to the user.
   $status = UC_FILE_ERROR_OK;
-  if (!user_access('view all downloads')) {
+  if (!$user->hasPermission('view all downloads')) {
     $status = _uc_file_download_validate($file_download, $user, $ip);
   }
   if ($status == UC_FILE_ERROR_OK) {
@@ -255,7 +255,7 @@ function _uc_file_download_validate($file_download, &$user, $ip) {
   $request_cache = cache_get('uc_file_' . $ip);
   $requests = ($request_cache) ? $request_cache->data + 1 : 1;
 
-  $message_user = ($user->id()) ? t('The user %username', array('%username' => user_format_name($user))) : t('The IP address %ip', array('%ip' => $ip));
+  $message_user = ($user->id()) ? t('The user %username', array('%username' => $user->getUsername())) : t('The IP address %ip', array('%ip' => $ip));
 
   if ($requests > UC_FILE_REQUEST_LIMIT) {
     return UC_FILE_ERROR_TOO_MANY_BOGUS_REQUESTS;
diff --git a/uc_order/lib/Drupal/uc_order/Plugin/views/argument_validator/CurrentUserOrPermission.php b/uc_order/lib/Drupal/uc_order/Plugin/views/argument_validator/CurrentUserOrPermission.php
index 3cba5fd..d281d7e 100644
--- a/uc_order/lib/Drupal/uc_order/Plugin/views/argument_validator/CurrentUserOrPermission.php
+++ b/uc_order/lib/Drupal/uc_order/Plugin/views/argument_validator/CurrentUserOrPermission.php
@@ -112,12 +112,12 @@ class CurrentUserOrPermission extends ArgumentValidatorPluginBase {
 
     // If the current user is not the account specified by the argument
     // and doesn't have the correct permission, validation fails.
-    if ($GLOBALS['user']->id() != $account->id() && !user_access($this->options['perm'])) {
+    if ($GLOBALS['user']->id() != $account->id() && !$account->hasPermission($this->options['perm'])) {
       return FALSE;
     }
 
     $this->argument->argument = $account->id();
-    $this->argument->validated_title = check_plain(user_format_name($account));
+    $this->argument->validated_title = check_plain($account->hasPermission($account));
     return TRUE;
   }
 
diff --git a/uc_order/lib/Drupal/uc_order/Plugin/views/field/FullName.php b/uc_order/lib/Drupal/uc_order/Plugin/views/field/FullName.php
index 7823063..fa09ab4 100644
--- a/uc_order/lib/Drupal/uc_order/Plugin/views/field/FullName.php
+++ b/uc_order/lib/Drupal/uc_order/Plugin/views/field/FullName.php
@@ -72,7 +72,8 @@ class FullName extends FieldPluginBase {
    * Data should be made XSS safe prior to calling this function.
    */
   protected function render_link($data, $values) {
-    if (!empty($this->options['link_to_user']) && user_access('access user profiles')) {
+    $account = \Drupal::currentUser();
+    if (!empty($this->options['link_to_user']) && $account->hasPermission('access user profiles')) {
       $this->options['alter']['make_link'] = TRUE;
       $this->options['alter']['path'] = 'user/' . $this->getValue($values, 'uid');;
     }
diff --git a/uc_order/lib/Drupal/uc_order/Plugin/views/field/Order.php b/uc_order/lib/Drupal/uc_order/Plugin/views/field/Order.php
index 1193cce..d1a06df 100644
--- a/uc_order/lib/Drupal/uc_order/Plugin/views/field/Order.php
+++ b/uc_order/lib/Drupal/uc_order/Plugin/views/field/Order.php
@@ -62,13 +62,14 @@ class Order extends FieldPluginBase {
    * Data should be made XSS safe prior to calling this function.
    */
   protected function render_link($data, $values) {
+    $account = \Drupal::currentUser();
     if (!empty($this->options['link_to_order'])) {
       $this->options['alter']['make_link'] = FALSE;
 
-      if (user_access('view all orders')) {
+      if ($account->hasPermission('view all orders')) {
         $path = 'admin/store/orders/' . $this->getValue($values, 'order_id');
       }
-      elseif (user_access('view own orders') && $this->getValue($values, 'uid') == $GLOBALS['user']->id()) {
+      elseif ($account->hasPermission('view own orders') && $this->getValue($values, 'uid') == $GLOBALS['user']->id()) {
         $path = 'user/' . $GLOBALS['user']->id() . '/orders/' . $this->getValue($values, 'order_id');
       }
       else {
diff --git a/uc_order/lib/Drupal/uc_order/UcOrderAccessController.php b/uc_order/lib/Drupal/uc_order/UcOrderAccessController.php
index a1a3d66..32c8dd8 100644
--- a/uc_order/lib/Drupal/uc_order/UcOrderAccessController.php
+++ b/uc_order/lib/Drupal/uc_order/UcOrderAccessController.php
@@ -24,27 +24,27 @@ class UcOrderAccessController extends EntityAccessController {
       case 'view':
       case 'invoice':
         // Admins can view all orders.
-        if (user_access('view all orders', $account)) {
+        if ($account->hasPermission('view all orders')) {
           return TRUE;
         }
         // Non-anonymous users can view their own orders and invoices with permission.
         $permission = $operation == 'view' ? 'view own orders' : 'view own invoices';
-        if ($account->id() && $account->id() == $entity->getUserId() && user_access($permission, $account)) {
+        if ($account->id() && $account->id() == $entity->getUserId() && $account->hasPermission($permission)) {
           return TRUE;
         }
         return FALSE;
         break;
 
       case 'update':
-        return user_access('edit orders', $account);
+        return $account->hasPermission('edit orders');
         break;
 
       case 'delete':
-        if (user_access('unconditionally delete orders', $account)) {
+        if ($account->hasPermission('unconditionally delete orders')) {
           // Unconditional deletion perms are always TRUE.
           return TRUE;
         }
-        if (user_access('delete orders', $account)) {
+        if ($account->hasPermission('delete orders')) {
           // Only users with unconditional deletion perms can delete completed orders.
           if ($entity->getStateId() == 'completed') {
             return FALSE;
@@ -73,7 +73,7 @@ class UcOrderAccessController extends EntityAccessController {
    * {@inheritdoc}
    */
   protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
-    return user_access('create orders', $account);
+    return $account->hasPermission('create orders');
   }
 
 }
diff --git a/uc_order/lib/Drupal/uc_order/UcOrderProductViewBuilder.php b/uc_order/lib/Drupal/uc_order/UcOrderProductViewBuilder.php
index 693f047..dbd9d5f 100644
--- a/uc_order/lib/Drupal/uc_order/UcOrderProductViewBuilder.php
+++ b/uc_order/lib/Drupal/uc_order/UcOrderProductViewBuilder.php
@@ -36,7 +36,8 @@ class UcOrderProductViewBuilder extends EntityViewBuilder {
         '#markup' => check_plain($product->model->value),
         '#cell_attributes' => array('class' => array('sku')),
       );
-      if (user_access('administer products')) {
+      $account = \Drupal::currentUser();
+      if ($account->hasPermission('administer products')) {
         $product->content['cost'] = array(
           '#theme' => 'uc_price',
           '#price' => $product->cost->value,
diff --git a/uc_order/uc_order.api.php b/uc_order/uc_order.api.php
index e0a4e11..8934b7f 100644
--- a/uc_order/uc_order.api.php
+++ b/uc_order/uc_order.api.php
@@ -188,8 +188,9 @@ function hook_uc_order($op, $order, $arg2) {
  *   - weight: Sets the display order of operations.
  */
 function hook_uc_order_actions($order) {
+  $account = \Drupal::currentUser();
   $actions = array();
-  if (user_access('fulfill orders')) {
+  if ($account->hasPermission('fulfill orders')) {
     $result = db_query("SELECT COUNT(nid) FROM {uc_order_products} WHERE order_id = :id AND data LIKE :data", array(':id' => $order->id(), ':data' => '%s:9:\"shippable\";s:1:\"1\";%'));
     if ($result->fetchField()) {
       $actions['package'] = array(
@@ -322,7 +323,7 @@ function hook_uc_order_pane_alter(&$panes) {
  *     object.
  */
 function uc_order_pane_callback($op, $order, &$form = NULL, &$form_state = NULL) {
-  global $user;
+  $user = \Drupal::currentUser();
 
   switch ($op) {
     case 'view':
diff --git a/uc_order/uc_order.module b/uc_order/uc_order.module
index c505995..3853e77 100644
--- a/uc_order/uc_order.module
+++ b/uc_order/uc_order.module
@@ -268,9 +268,11 @@ function uc_order_field_extra_fields() {
  * Implements hook_user_view().
  */
 function uc_order_user_view($account, $view_mode) {
-  global $user;
+  $user = \Drupal::currentUser();
 
-  if ($view_mode == 'full' && $user->isAuthenticated() && (($user->id() == $account->id() && user_access('view own orders')) || user_access('view all orders'))) {
+  if ($view_mode == 'full' &&
+      $user->isAuthenticated() &&
+      (($user->id() == $account->id() && $user->hasPermission('view own orders')) || $user->hasPermission('view all orders'))) {
     $account->content['orders'] = array(
       '#type' => 'item',
       '#title' => t('Orders'),
@@ -1015,11 +1017,11 @@ function uc_order_status_options_list() {
  *   A renderable set of operation links.
  */
 function uc_order_actions($order, $icon_html = FALSE) {
-  global $user;
+  $user = \Drupal::currentUser();
 
   $actions = array();
 
-  if (user_access('view all orders')) {
+  if ($user->hasPermission('view all orders')) {
     $actions['view'] = array(
       'title' => t('View'),
       'href' => 'admin/store/orders/' . $order->id(),
diff --git a/uc_order/uc_order.order_pane.inc b/uc_order/uc_order.order_pane.inc
index 0ccfb6a..e750322 100644
--- a/uc_order/uc_order.order_pane.inc
+++ b/uc_order/uc_order.order_pane.inc
@@ -227,7 +227,8 @@ function uc_order_pane_products($op, $order, &$form = NULL, &$form_state = NULL)
         '#empty' => t('This order contains no products.'),
       );
 
-      if (!user_access('administer products')) {
+      $account = \Drupal::currentUser();
+      if (!$account->hasPermission('administer products')) {
         unset($build['#header']['cost']);
       }
 
@@ -958,8 +959,6 @@ function uc_order_pane_order_comments($op, $order, &$form = NULL, &$form_state =
  * Handles the "Admin Comments" order pane.
  */
 function uc_order_pane_admin_comments($op, $order, &$form = NULL, &$form_state = NULL) {
-  global $user;
-
   switch ($op) {
     case 'view':
       $build = array(
@@ -1011,7 +1010,8 @@ function uc_order_pane_admin_comments($op, $order, &$form = NULL, &$form_state =
 
     case 'edit-process':
       if (!empty($form_state['values']['admin_comment'])) {
-        uc_order_comment_save($form_state['values']['order_id'], $user->id(), $form_state['values']['admin_comment']);
+        $uid = \Drupal::currentUser()->id();
+        uc_order_comment_save($form_state['values']['order_id'], $uid, $form_state['values']['admin_comment']);
       }
       return;
   }
@@ -1098,20 +1098,20 @@ function uc_order_view_update_form($form, &$form_state, $order) {
  * @see uc_order_view_update_form()
  */
 function uc_order_view_update_form_submit($form, &$form_state) {
-  global $user;
+  $uid = \Drupal::currentUser()->id();
 
   if (!empty($form_state['values']['order_comment'])) {
-    uc_order_comment_save($form_state['values']['order_id'], $user->id(), $form_state['values']['order_comment'], 'order', $form_state['values']['status'], $form_state['values']['notify']);
+    uc_order_comment_save($form_state['values']['order_id'], $uid, $form_state['values']['order_comment'], 'order', $form_state['values']['status'], $form_state['values']['notify']);
   }
 
   if (!empty($form_state['values']['admin_comment'])) {
-    uc_order_comment_save($form_state['values']['order_id'], $user->id(), $form_state['values']['admin_comment']);
+    uc_order_comment_save($form_state['values']['order_id'], $uid, $form_state['values']['admin_comment']);
   }
 
   if ($form_state['values']['status'] != $form_state['values']['current_status']) {
     if (uc_order_update_status($form_state['values']['order_id'], $form_state['values']['status'])) {
       if (empty($form_state['values']['order_comment'])) {
-        uc_order_comment_save($form_state['values']['order_id'], $user->id(), '-', 'order', $form_state['values']['status'], $form_state['values']['notify']);
+        uc_order_comment_save($form_state['values']['order_id'], $uid, '-', 'order', $form_state['values']['status'], $form_state['values']['notify']);
       }
     }
   }
diff --git a/uc_product/uc_product.module b/uc_product/uc_product.module
index 7c0b513..f8d5d8b 100644
--- a/uc_product/uc_product.module
+++ b/uc_product/uc_product.module
@@ -617,7 +617,7 @@ function uc_product_view_product(EntityInterface $node, EntityDisplay $display,
         'uc-product-' . $node->id(),
       ),
     ),
-    '#access' => user_access('administer products'),
+    '#access' => \Drupal::currentUser()->hasPermission('administer products'),
   );
   $node->content['sell_price'] = array(
     '#theme' => 'uc_product_price',
diff --git a/uc_roles/uc_roles.module b/uc_roles/uc_roles.module
index f9d9d7d..3ef1195 100644
--- a/uc_roles/uc_roles.module
+++ b/uc_roles/uc_roles.module
@@ -133,7 +133,7 @@ function uc_roles_theme() {
 function uc_roles_form_user_profile_form_alter(&$form, &$form_state) {
   $account = $form_state['user'];
 
-  if (!user_access('administer users')) {
+  if (!\Drupal::currentUser()->hasPermission('administer users')) {
     return;
   }
 
@@ -280,7 +280,7 @@ function uc_roles_user_cancel($edit, $account, $method) {
  * Implements hook_user_presave().
  */
 function uc_roles_user_presave($account) {
-  if (!user_access('administer users')) {
+  if (!\Drupal::currentUser()->hasPermission('administer users')) {
     return;
   }
 
@@ -345,7 +345,7 @@ function uc_roles_user_view($account, $view_mode) {
   // Only show if this user can access all role expirations, or if it's the same
   // user and the expirations are showing on the user pages.
   $show_expiration = variable_get('uc_roles_default_show_expiration', TRUE);
-  if (!user_access('view all role expirations') && ($user->id() != $account->id() || !$show_expiration)) {
+  if (!$user->hasPermission('view all role expirations') && ($user->id() != $account->id() || !$show_expiration)) {
     return;
   }
 
diff --git a/uc_stock/uc_stock.admin.inc b/uc_stock/uc_stock.admin.inc
index 17f4c77..6f399ca 100644
--- a/uc_stock/uc_stock.admin.inc
+++ b/uc_stock/uc_stock.admin.inc
@@ -48,7 +48,7 @@ function uc_stock_report() {
   $result = $query->execute();
   foreach ($result as $stock) {
     $op = array();
-    if (user_access('administer product stock')) {
+    if (\Drupal::currentUser()->hasPermission('administer product stock')) {
       $op[] = l(t('edit'), 'node/' . $stock->nid . '/edit/stock', $options = array('query' => array('destination' => 'admin/store/reports/stock')));
     }
 
