public function fromLdap($value)
{
if (!$this->getLdapConnection()) {
return $value;
}
/**
* This is a rather expensive operation just to get a group name that will probably either always be the same
* for all users in a domain or is very, very unlikely to ever change. Perhaps find a way to cache this or speed
* it up?
*/
$userSid = $this->getCurrentLdapAttributeValue('objectSid');
$groupSid = preg_replace('/\\d+$/', $value, (new ConvertWindowsSid())->fromLdap($userSid));
return (new LdapQueryBuilder($this->getLdapConnection()))->select('cn')->where(['objectSid' => (new ConvertWindowsSid())->setOperationType(self::TYPE_SEARCH_TO)->toLdap($groupSid)])->getLdapQuery()->getSingleScalarResult();
}