Attribute is no longer iterable - cant be used now that we manage attribute tags
This commit is contained in:
parent
cf535286c5
commit
28f4869628
@ -12,7 +12,7 @@ use App\Ldap\Entry;
|
|||||||
/**
|
/**
|
||||||
* Represents an attribute of an LDAP Object
|
* Represents an attribute of an LDAP Object
|
||||||
*/
|
*/
|
||||||
class Attribute implements \Countable, \ArrayAccess, \Iterator
|
class Attribute implements \Countable, \ArrayAccess
|
||||||
{
|
{
|
||||||
// Attribute Name
|
// Attribute Name
|
||||||
protected string $name;
|
protected string $name;
|
||||||
@ -181,44 +181,19 @@ class Attribute implements \Countable, \ArrayAccess, \Iterator
|
|||||||
|
|
||||||
/* INTERFACE */
|
/* INTERFACE */
|
||||||
|
|
||||||
public function current(): mixed
|
|
||||||
{
|
|
||||||
return $this->values->get($this->counter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function next(): void
|
|
||||||
{
|
|
||||||
$this->counter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function key(): mixed
|
|
||||||
{
|
|
||||||
return $this->counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function valid(): bool
|
|
||||||
{
|
|
||||||
return $this->values->has($this->counter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function rewind(): void
|
|
||||||
{
|
|
||||||
$this->counter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function count(): int
|
public function count(): int
|
||||||
{
|
{
|
||||||
return $this->values->count();
|
return $this->_values->dot()->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetExists(mixed $offset): bool
|
public function offsetExists(mixed $offset): bool
|
||||||
{
|
{
|
||||||
return ! is_null($this->values->has($offset));
|
return $this->_values->dot()->has($offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet(mixed $offset): mixed
|
public function offsetGet(mixed $offset): mixed
|
||||||
{
|
{
|
||||||
return $this->values->get($offset);
|
return $this->_values->dot()->get($offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetSet(mixed $offset, mixed $value): void
|
public function offsetSet(mixed $offset, mixed $value): void
|
||||||
@ -323,12 +298,12 @@ class Attribute implements \Countable, \ArrayAccess, \Iterator
|
|||||||
|
|
||||||
public function render_item_old(string $dotkey): ?string
|
public function render_item_old(string $dotkey): ?string
|
||||||
{
|
{
|
||||||
return Arr::get($this->_values_old->dot(),$dotkey);
|
return Arr::get($this->values_old->dot(),$dotkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render_item_new(string $dotkey): ?string
|
public function render_item_new(string $dotkey): ?string
|
||||||
{
|
{
|
||||||
return Arr::get($this->_values->dot(),$dotkey);
|
return Arr::get($this->values->dot(),$dotkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -267,19 +267,22 @@ class HomeController extends Controller
|
|||||||
// We need to process and encrypt the password
|
// We need to process and encrypt the password
|
||||||
if ($request->userpassword) {
|
if ($request->userpassword) {
|
||||||
$passwords = [];
|
$passwords = [];
|
||||||
foreach ($request->userpassword as $key => $value) {
|
$po = $o->getObject('userpassword');
|
||||||
|
foreach (Arr::dot($request->userpassword) as $dotkey => $value) {
|
||||||
// If the password is still the MD5 of the old password, then it hasnt changed
|
// If the password is still the MD5 of the old password, then it hasnt changed
|
||||||
if (($old=Arr::get($o->userpassword,$key)) && ($value === md5($old))) {
|
if (($old=Arr::get($po,$dotkey)) && ($value === md5($old))) {
|
||||||
array_push($passwords,$old);
|
$passwords[$dotkey] = $value;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($value) {
|
if ($value) {
|
||||||
$type = Arr::get($request->userpassword_hash,$key);
|
$type = Arr::get($request->userpassword_hash,$dotkey);
|
||||||
array_push($passwords,Password::hash_id($type)->encode($value));
|
$passwords[$dotkey] = Password::hash_id($type)
|
||||||
|
->encode($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$o->userpassword = $passwords;
|
|
||||||
|
$o->userpassword = Arr::undot($passwords);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $o->getDirty())
|
if (! $o->getDirty())
|
||||||
|
@ -11,8 +11,8 @@ trait MD5Updates
|
|||||||
{
|
{
|
||||||
public function isDirty(): bool
|
public function isDirty(): bool
|
||||||
{
|
{
|
||||||
foreach ($this->values->diff($this->values_old) as $key => $value)
|
foreach ($this->values_old->dot()->keys()->merge($this->values->dot()->keys())->unique() as $dotkey)
|
||||||
if (md5(Arr::get($this->values_old,$key)) !== $value)
|
if (md5(Arr::get($this->values_old->dot(),$dotkey)) !== Arr::get($this->values->dot(),$dotkey))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user