Skip to content
Snippets Groups Projects
Commit 9d5cb43e authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2062009 by InternetDevels: Replace user_access() calls with...

Issue #2062009 by InternetDevels: Replace user_access() calls with ->hasPermission() in overlay module.
parent 3bd311da
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -28,7 +28,7 @@ public function applies(Route $route) {
*/
public function access(Route $route, Request $request) {
$account = $request->attributes->get('_account');
if (!user_access('access overlay', $account)) {
if (!$account->hasPermission('access overlay')) {
return static::DENY;
}
// It's unlikely, but possible that "access overlay" permission is granted
......
......@@ -80,7 +80,7 @@ public function onRequest(GetResponseEvent $event) {
// set. Other modules can also enable the overlay directly for other uses.
$user_data = $this->userData->get('overlay', $user->id(), 'enabled');
$use_overlay = !isset($user_data) || $user_data;
if (empty($mode) && user_access('access overlay') && $use_overlay) {
if (empty($mode) && $user->hasPermission('access overlay') && $use_overlay) {
$current_path = $request->attributes->get('_system_path');
// After overlay is enabled on the modules page, redirect to
// <front>#overlay=admin/modules to actually enable the overlay.
......
......@@ -82,7 +82,7 @@ function overlay_field_extra_fields() {
*/
function overlay_form_user_form_alter(&$form, &$form_state) {
$account = $form_state['controller']->getEntity();
if (user_access('access overlay', $account)) {
if ($account->hasPermission('access overlay')) {
$account_data = Drupal::service('user.data')->get('overlay', $account->id(), 'enabled');
$form['overlay_control'] = array(
'#type' => 'details',
......@@ -218,7 +218,7 @@ function overlay_disable_message() {
global $user;
$build = array();
if ($user->isAnonymous() || !user_access('access overlay')) {
if ($user->isAnonymous() || !$user->hasPermission('access overlay')) {
return $build;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment