Compare commits
3 Commits
66537dcec8
...
a7be4e00b4
Author | SHA1 | Date | |
---|---|---|---|
a7be4e00b4 | |||
2abc321eca | |||
6b2fb8dee4 |
@ -226,12 +226,15 @@ class Attribute implements \Countable, \ArrayAccess
|
|||||||
/**
|
/**
|
||||||
* Return the hints about this attribute, ie: RDN, Required, etc
|
* Return the hints about this attribute, ie: RDN, Required, etc
|
||||||
*
|
*
|
||||||
* @return array
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function hints(): array
|
public function hints(): Collection
|
||||||
{
|
{
|
||||||
$result = collect();
|
$result = collect();
|
||||||
|
|
||||||
|
if ($this->is_internal)
|
||||||
|
return $result;
|
||||||
|
|
||||||
// Is this Attribute an RDN
|
// Is this Attribute an RDN
|
||||||
if ($this->is_rdn)
|
if ($this->is_rdn)
|
||||||
$result->put(__('rdn'),__('This attribute is required for the RDN'));
|
$result->put(__('rdn'),__('This attribute is required for the RDN'));
|
||||||
@ -246,7 +249,7 @@ class Attribute implements \Countable, \ArrayAccess
|
|||||||
if ($this->isDynamic())
|
if ($this->isDynamic())
|
||||||
$result->put(__('dynamic'),__('These are dynamic values present as a result of another attribute'));
|
$result->put(__('dynamic'),__('These are dynamic values present as a result of another attribute'));
|
||||||
|
|
||||||
return $result->toArray();
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,6 +6,7 @@ use Illuminate\Contracts\View\View;
|
|||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute;
|
use App\Classes\LDAP\Attribute;
|
||||||
|
use App\Ldap\Entry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an ObjectClass Attribute
|
* Represents an ObjectClass Attribute
|
||||||
@ -74,6 +75,7 @@ final class ObjectClass extends Attribute
|
|||||||
return view('components.attribute.objectclass')
|
return view('components.attribute.objectclass')
|
||||||
->with('o',$this)
|
->with('o',$this)
|
||||||
->with('edit',$edit)
|
->with('edit',$edit)
|
||||||
|
->with('langtag',Entry::TAG_NOTAG)
|
||||||
->with('old',$old)
|
->with('old',$old)
|
||||||
->with('new',$new);
|
->with('new',$new);
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,11 @@ final class RDN extends Attribute
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hints(): array
|
public function hints(): Collection
|
||||||
{
|
{
|
||||||
return [
|
return collect([
|
||||||
'required' => __('RDN is required')
|
'required' => __('RDN is required')
|
||||||
];
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View
|
public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View
|
||||||
|
@ -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
|
||||||
|
@ -97,7 +97,6 @@ class APIController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Return the required and additional attributes for an object class
|
* Return the required and additional attributes for an object class
|
||||||
*
|
*
|
||||||
* @param Request $request
|
|
||||||
* @param string $objectclass
|
* @param string $objectclass
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -93,10 +93,12 @@ class HomeController extends Controller
|
|||||||
|
|
||||||
return $request->noheader
|
return $request->noheader
|
||||||
? 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: $dn,attribute: $id,values: [],oc: $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),new: TRUE,edit: TRUE)
|
||||||
|
->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function entry_create(EntryAddRequest $request): \Illuminate\Http\RedirectResponse
|
public function entry_create(EntryAddRequest $request): \Illuminate\Http\RedirectResponse
|
||||||
|
@ -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
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\View\Components;
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\View\Component;
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute as LDAPAttribute;
|
use App\Classes\LDAP\Attribute as LDAPAttribute;
|
||||||
@ -32,13 +34,13 @@ class Attribute extends Component
|
|||||||
/**
|
/**
|
||||||
* Get the view / contents that represent the component.
|
* Get the view / contents that represent the component.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
* @return View|string
|
||||||
*/
|
*/
|
||||||
public function render()
|
public function render(): View|string
|
||||||
{
|
{
|
||||||
return $this->o
|
return $this->o
|
||||||
? $this->o
|
? $this->o
|
||||||
->render($this->edit,$this->old,$this->new)
|
->render(edit: $this->edit,old: $this->old,new: $this->new)
|
||||||
: $this->na;
|
: $this->na;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\View\Components;
|
namespace App\View\Components;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\View\Component;
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ class AttributeType extends Component
|
|||||||
/**
|
/**
|
||||||
* Get the view / contents that represent the component.
|
* Get the view / contents that represent the component.
|
||||||
*/
|
*/
|
||||||
public function render(): View|Closure|string
|
public function render(): View
|
||||||
{
|
{
|
||||||
return view('components.attribute-type')
|
return view('components.attribute-type')
|
||||||
->with('o',$this->o)
|
->with('o',$this->o)
|
||||||
|
@ -46,6 +46,9 @@
|
|||||||
if (added_oc.indexOf(item) !== -1)
|
if (added_oc.indexOf(item) !== -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Add our new OC to the list of OCs
|
||||||
|
oc.push(item);
|
||||||
|
|
||||||
// Add attribute to the page
|
// Add attribute to the page
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -146,7 +149,7 @@
|
|||||||
if (x.length) {
|
if (x.length) {
|
||||||
x.remove();
|
x.remove();
|
||||||
|
|
||||||
// Add this to the must attrs list, because its been rendered
|
// Add this to the must attrs list, because its been rendered
|
||||||
} else {
|
} else {
|
||||||
attrs.push(mayitem);
|
attrs.push(mayitem);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user