get_scope(), LAM\TYPES\getTypes()); } /** * {@inheritDoc} */ public function get_metaData(): array { $return = []; // icon $return['icon'] = 'info.svg'; // alias name $return["alias"] = _("General information"); // module dependencies $return['dependencies'] = ['depends' => [], 'conflicts' => []]; // managed attributes $return['attributes'] = ['creatorsname', 'createtimestamp', 'modifiersname', 'modifytimestamp', 'hassubordinates', 'memberof']; $return['hiddenAttributes'] = ['creatorsname', 'createtimestamp', 'modifiersname', 'modifytimestamp', 'hassubordinates']; return $return; } /** * {@inheritDoc} */ public function display_html_attributes(): htmlElement|array { $return = new htmlResponsiveRow(); // creation info if (isset($this->attributes['creatorsname'][0])) { $return->addLabel(new htmlOutputText(_('Created by'))); $return->addField(new htmlOutputText(getAbstractDN($this->attributes['creatorsname'][0]))); } if (isset($this->attributes['createtimestamp'][0])) { $return->addLabel(new htmlOutputText(_('Creation time'))); $return->addField(new htmlOutputText(formatLDAPTimestamp($this->attributes['createtimestamp'][0]))); } if (isset($this->attributes['creatorsname'][0]) || isset($this->attributes['createtimestamp'][0])) { $return->addVerticalSpacer('1rem'); } // modification info if (isset($this->attributes['modifiersname'][0])) { $return->addLabel(new htmlOutputText(_('Modified by'))); $return->addField(new htmlOutputText(getAbstractDN($this->attributes['modifiersname'][0]))); } if (isset($this->attributes['modifytimestamp'][0])) { $return->addLabel(new htmlOutputText(_('Modification time'))); $return->addField(new htmlOutputText(formatLDAPTimestamp($this->attributes['modifytimestamp'][0]))); } if (isset($this->attributes['modifiersname'][0]) || isset($this->attributes['modifytimestamp'][0])) { $return->addVerticalSpacer('1rem'); } // children if (isset($this->attributes['hassubordinates'][0])) { $hasChilds = _('no'); if ($this->attributes['hassubordinates'][0] == 'TRUE') { $hasChilds = _('yes'); } $return->addLabel(new htmlOutputText(_('Has subentries'))); $return->addField(new htmlOutputText($hasChilds)); $return->addVerticalSpacer('1rem'); } // group memberships if (isset($this->attributes['memberof'][0])) { $typeManager = new TypeManager(); $scopes = ['gon', 'group']; $types = $typeManager->getConfiguredTypesForScopes($scopes); $suffixList = []; foreach ($types as $type) { $suffix = $type->getSuffix(); // continue if suffixes are not unique if (isset($suffixList[$suffix])) { continue; } if (!empty($suffix)) { $suffixList[$suffix] = $type->getId(); } } $groupLabel = new htmlOutputText(_('Groups')); $groupLabel->alignment = htmlElement::ALIGN_TOP; $return->addLabel($groupLabel); $groups = new htmlTable(); foreach ($this->attributes['memberof'] as $memberOf) { $groupEntry = new htmlOutputText(getAbstractDN($memberOf)); foreach ($suffixList as $suffix => $type) { if ((stripos($memberOf, $suffix) > 0) && !isAccountTypeHidden($type)) { $groupEntry = new htmlLink(getAbstractDN($memberOf), 'edit.php?type=' . $type . '&DN=\'' . $memberOf . '\''); $groupEntry->setTargetWindow('_blank'); break; } } $groups->addElement($groupEntry, true); } $return->addField($groups); } return $return; } /** * {@inheritDoc} */ public function process_attributes(): array { return []; } /** * {@inheritDoc} */ public function loadAttributesFromAccountCopy(array $ldapAttributes, array $attributesToIgnore = []): void { // no action for this module } /** * @inheritDoc */ public function getListAttributeDescriptions(ConfiguredType $type): array { return [ 'creatorsname' => _('Created by'), 'createtimestamp' => _('Creation time'), 'modifiersname' => _('Modified by'), 'modifytimestamp' => _('Modification time'), 'hassubordinates' => _('Has subentries'), 'memberof' => _('Groups') ]; } }