Fix for showing no_lang_tag attrs (which are displayed without values) on a lang_tag attr pane when viewing a DN

This commit is contained in:
Deon George 2025-04-08 14:29:21 +10:00
parent 6b2fb8dee4
commit 2abc321eca
3 changed files with 14 additions and 11 deletions

View File

@ -66,6 +66,7 @@ class LDIF extends Import
$m = []; $m = [];
preg_match('/^([a-zA-Z0-9;-]+)(:+)\s+(.*)$/',$line,$m); preg_match('/^([a-zA-Z0-9;-]+)(:+)\s+(.*)$/',$line,$m);
dump(['m'=>$m,'line'=>$line]);
switch (Arr::get($m,1)) { switch (Arr::get($m,1)) {
case 'changetype': case 'changetype':
@ -156,7 +157,7 @@ class LDIF extends Import
return $result; return $result;
} }
public function readEntry() { public function xreadEntry() {
static $haveVersion = FALSE; static $haveVersion = FALSE;
if ($lines = $this->nextLines()) { if ($lines = $this->nextLines()) {
@ -218,7 +219,7 @@ class LDIF extends Import
default: default:
if (! $server->dnExists($dn)) if (! $server->dnExists($dn))
return $this->error(_('Unkown change type'),$lines); return $this->error(_('Unknown change type'),$lines);
} }
} else } else

View File

@ -95,8 +95,10 @@ class HomeController extends Controller
? view(sprintf('components.attribute.widget.%s',$id)) ? view(sprintf('components.attribute.widget.%s',$id))
->with('o',Factory::create($dn,$id,[],$request->objectclasses)) ->with('o',Factory::create($dn,$id,[],$request->objectclasses))
->with('value',$request->value) ->with('value',$request->value)
->with('langtag',Entry::TAG_NOTAG)
->with('loop',$xx) ->with('loop',$xx)
: new AttributeType(Factory::create($dn,$id,[],$request->objectclasses),TRUE)->render(); : new AttributeType(Factory::create($dn,$id,[],$request->objectclasses),TRUE)
->render();
} }
public function entry_create(EntryAddRequest $request): \Illuminate\Http\RedirectResponse public function entry_create(EntryAddRequest $request): \Illuminate\Http\RedirectResponse

View File

@ -422,22 +422,22 @@ class Entry extends Model
/** /**
* Return this list of user attributes * Return this list of user attributes
* *
* @param string|null $tag If null return all tags * @param string $tag If null return all tags
* @return Collection * @return Collection
*/ */
public function getVisibleAttributes(?string $tag=NULL): Collection public function getVisibleAttributes(string $tag=''): Collection
{ {
static $cache = NULL; static $cache = [];
if (is_null($cache)) { if (! Arr::get($cache,$tag ?: '_all_')) {
$ot = $this->getOtherTags(); $ot = $this->getOtherTags();
$cache = $this->objects $cache[$tag ?: '_all_'] = $this->objects
->filter(fn($item)=>! $item->is_internal) ->filter(fn($item)=>(! $item->is_internal) && ((! $item->no_attr_tags) || (! $tag) || ($tag === Entry::TAG_NOTAG)))
->filter(fn($item)=>is_null($tag) || $ot->has($item->name_lc) || count($item->tagValues($tag)) > 0); ->filter(fn($item)=>(! $tag) || $ot->has($item->name_lc) || count($item->tagValues($tag)) > 0);
} }
return $cache; return $cache[$tag ?: '_all_'];
} }
public function hasAttribute(int|string $key): bool public function hasAttribute(int|string $key): bool