Skip to content
Snippets Groups Projects

Issue #540008: Remove the special behavior of uid #1.

Open Issue #540008: Remove the special behavior of uid #1.
2 unresolved threads
Open Eelke Blok requested to merge issue/drupal-540008:540008-remove-the-special into 9.3.x
2 unresolved threads
Files
55
@@ -3,14 +3,28 @@
namespace Drupal\Core\Cache\Context;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Session\AccountInterface;
/**
* Defines the IsSuperUserCacheContext service, for "super user or not" caching.
*
* Cache context ID: 'user.is_super_user'.
*
* @deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. See
* https://www.drupal.org/node/2910500 for more information.
*
* @see https://www.drupal.org/node/2910500
*/
class IsSuperUserCacheContext extends UserCacheContextBase implements CacheContextInterface {
/**
* {@inheritdoc}
*/
public function __construct(AccountInterface $user) {
@trigger_error('\Drupal\Core\Cache\Context\IsSuperUserCacheContext is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. See https://www.drupal.org/node/2910500 for more information.', E_USER_DEPRECATED);
parent::__construct($user);
}
/**
* {@inheritdoc}
*/
@@ -22,7 +36,9 @@ public static function getLabel() {
* {@inheritdoc}
*/
public function getContext() {
return ((int) $this->user->id()) === 1 ? '1' : '0';
// Always return 0 as there is no longer a super user. See:
// https://www.drupal.org/node/540008
return '0';
}
/**
Loading