Skip to content

Commit

Permalink
CC-17043 Renamed root group visible name. (#10951)
Browse files Browse the repository at this point in the history
CC-17043 Renamed root group visible name.
  • Loading branch information
gechetspr authored May 27, 2024
1 parent e60fa4a commit cb912c1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Spryker/Zed/Acl/Communication/Table/GroupTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Orm\Zed\Acl\Persistence\SpyAclGroupQuery;
use Spryker\Service\UtilDateTime\UtilDateTimeServiceInterface;
use Spryker\Service\UtilText\Model\Url\Url;
use Spryker\Shared\Acl\AclConstants;
use Spryker\Zed\Gui\Communication\Table\AbstractTable;
use Spryker\Zed\Gui\Communication\Table\TableConfiguration;

Expand All @@ -31,6 +32,11 @@ class GroupTable extends AbstractTable
*/
public const EDIT_PARAMETER = 'id-group';

/**
* @var string
*/
protected const ROOT_GROUP_VISIBLE_NAME = 'Administrators group (%s)';

/**
* @var \Orm\Zed\Acl\Persistence\SpyAclGroupQuery
*/
Expand Down Expand Up @@ -93,7 +99,7 @@ protected function prepareData(TableConfiguration $config)

foreach ($groupCollection as $group) {
$groups[] = [
SpyAclGroupTableMap::COL_NAME => $group[SpyAclGroupTableMap::COL_NAME],
SpyAclGroupTableMap::COL_NAME => $this->prepareGroupName($group[SpyAclGroupTableMap::COL_NAME]),
SpyAclGroupTableMap::COL_CREATED_AT => $this->utilDateTimeService->formatDateTime($group[SpyAclGroupTableMap::COL_CREATED_AT]),
static::ROLES => $this->createRoleUrl($group),
static::EDIT => $this->createEditUrl($group),
Expand All @@ -103,6 +109,16 @@ protected function prepareData(TableConfiguration $config)
return $groups;
}

/**
* @param string $groupName
*
* @return string
*/
protected function prepareGroupName(string $groupName): string
{
return $groupName !== AclConstants::ROOT_GROUP ? $groupName : sprintf(static::ROOT_GROUP_VISIBLE_NAME, AclConstants::ROOT_GROUP);
}

/**
* @param array $group
*
Expand Down

0 comments on commit cb912c1

Please sign in to comment.