Verified Commit 4fe31f3f authored by Dave Long's avatar Dave Long
Browse files

feat: #256287 Give roles a description value

By: webchick
By: anybody
By: meenakshig
By: grahl
By: derekcresswell
By: longwave
By: ridhimaabrol24
By: paulocs
By: megachriz
By: damiaosj
By: alanmoreira
By: yoroy
By: rkoller
By: smustgrave
By: raman.b
By: ravi.shankar
By: grevil
By: godotislate
(cherry picked from commit 00dfe3f4)
parent f871b011
Loading
Loading
Loading
Loading
+1 −0
Changes for core/modules/jsonapi/tests/src/Functional/RoleTest.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ protected function getExpectedDocument(): array {
          'status' => TRUE,
          'dependencies' => [],
          'label' => 'Llama',
          'description' => '',
          'is_admin' => FALSE,
          'permissions' => [],
          'drupal_internal__id' => 'llama',
+1 −0
Changes for core/modules/user/config/install/user.role.anonymous.yml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ status: true
dependencies: {  }
id: anonymous
label: 'Anonymous user'
description: ''
weight: 0
is_admin: false
permissions: {  }
+1 −0
Changes for core/modules/user/config/install/user.role.authenticated.yml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ status: true
dependencies: {  }
id: authenticated
label: 'Authenticated user'
description: ''
weight: 1
is_admin: false
permissions: {  }
+3 −0
Changes for core/modules/user/config/schema/user.schema.yml: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -143,6 +143,9 @@ user.role.*:
    label:
      type: required_label
      label: 'Label'
    description:
      type: text
      label: 'Description'
    weight:
      type: weight
      label: 'User role weight'
+23 −0
Changes for core/modules/user/src/Entity/Role.php: 23 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@
  config_export: [
    'id',
    'label',
    'description',
    'weight',
    'is_admin',
    'permissions',
@@ -74,6 +75,13 @@ class Role extends ConfigEntityBase implements RoleInterface {
   */
  protected $label;

  /**
   * A brief description of this role.
   *
   * @var string
   */
  protected string $description = '';

  /**
   * The weight of this role in administrative listings.
   *
@@ -105,6 +113,21 @@ public function getPermissions() {
    return $this->permissions;
  }

  /**
   * {@inheritdoc}
   */
  public function getDescription(): string {
    return $this->description;
  }

  /**
   * {@inheritdoc}
   */
  public function setDescription(string $description): static {
    $this->description = $description;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
Loading