Issue #2062009 by InternetDevels: Replace user_access() calls with ->hasPermission() in overlay module.
parent
3bd311da45
commit
9d5cb43e56
|
@ -28,7 +28,7 @@ class DismissMessageAccessCheck implements AccessCheckInterface {
|
||||||
*/
|
*/
|
||||||
public function access(Route $route, Request $request) {
|
public function access(Route $route, Request $request) {
|
||||||
$account = $request->attributes->get('_account');
|
$account = $request->attributes->get('_account');
|
||||||
if (!user_access('access overlay', $account)) {
|
if (!$account->hasPermission('access overlay')) {
|
||||||
return static::DENY;
|
return static::DENY;
|
||||||
}
|
}
|
||||||
// It's unlikely, but possible that "access overlay" permission is granted
|
// It's unlikely, but possible that "access overlay" permission is granted
|
||||||
|
|
|
@ -80,7 +80,7 @@ class OverlaySubscriber implements EventSubscriberInterface {
|
||||||
// set. Other modules can also enable the overlay directly for other uses.
|
// set. Other modules can also enable the overlay directly for other uses.
|
||||||
$user_data = $this->userData->get('overlay', $user->id(), 'enabled');
|
$user_data = $this->userData->get('overlay', $user->id(), 'enabled');
|
||||||
$use_overlay = !isset($user_data) || $user_data;
|
$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');
|
$current_path = $request->attributes->get('_system_path');
|
||||||
// After overlay is enabled on the modules page, redirect to
|
// After overlay is enabled on the modules page, redirect to
|
||||||
// <front>#overlay=admin/modules to actually enable the overlay.
|
// <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) {
|
function overlay_form_user_form_alter(&$form, &$form_state) {
|
||||||
$account = $form_state['controller']->getEntity();
|
$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');
|
$account_data = Drupal::service('user.data')->get('overlay', $account->id(), 'enabled');
|
||||||
$form['overlay_control'] = array(
|
$form['overlay_control'] = array(
|
||||||
'#type' => 'details',
|
'#type' => 'details',
|
||||||
|
@ -218,7 +218,7 @@ function overlay_disable_message() {
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$build = array();
|
$build = array();
|
||||||
if ($user->isAnonymous() || !user_access('access overlay')) {
|
if ($user->isAnonymous() || !$user->hasPermission('access overlay')) {
|
||||||
return $build;
|
return $build;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue