Verified Commit 57ec49e0 authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: Feat(ListingManagement) - adapted

Adaps class listing to php8.2
No related merge requests found
Showing with 12 additions and 8 deletions
+12 -8
...@@ -40,36 +40,39 @@ class ListingEntry implements ArrayAccess ...@@ -40,36 +40,39 @@ class ListingEntry implements ArrayAccess
* \brief Object type * \brief Object type
*/ */
public $type; public $type;
private $attrs;
protected $listing; protected $listing;
/* Cache where columns may store stuff */ /* Cache where columns may store stuff */
public $cache = []; public $cache = [];
public function __construct (managementListing $listing, string $type, string $dn, private array $attrs, int $row = NULL) public function __construct (managementListing $listing, string $type, string $dn, array $attrs, int $row = NULL)
{ {
$this->listing = $listing; $this->listing = $listing;
$this->type = $type; $this->type = $type;
$this->dn = $dn; $this->dn = $dn;
$this->aclBase = $dn; $this->aclBase = $dn;
$this->attrs = $attrs;
$this->row = $row; $this->row = $row;
} }
public function offsetSet ($offset, $value) : void public function offsetSet ($offset, $value)
{ {
$this->attrs[$offset] = $value; $this->attrs[$offset] = $value;
} }
public function offsetExists ($offset) : bool public function offsetExists ($offset)
{ {
return isset($this->attrs[$offset]); return isset($this->attrs[$offset]);
} }
public function offsetUnset ($offset) : void public function offsetUnset ($offset)
{ {
unset($this->attrs[$offset]); unset($this->attrs[$offset]);
} }
public function offsetGet ($offset) : mixed public function offsetGet ($offset)
{ {
return (isset($this->attrs[$offset]) ? $this->attrs[$offset] : NULL); return (isset($this->attrs[$offset]) ? $this->attrs[$offset] : NULL);
} }
...@@ -81,12 +84,12 @@ class ListingEntry implements ArrayAccess ...@@ -81,12 +84,12 @@ class ListingEntry implements ArrayAccess
public function isTemplate (): bool public function isTemplate (): bool
{ {
return preg_match('/^template_/', (string) $this->type); return preg_match('/^template_/', $this->type);
} }
public function getTemplatedType (): string public function getTemplatedType (): string
{ {
return preg_replace('/^template_/', '', (string) $this->type); return preg_replace('/^template_/', '', $this->type);
} }
public function getTemplatedFields (): array public function getTemplatedFields (): array
...@@ -101,7 +104,7 @@ class ListingEntry implements ArrayAccess ...@@ -101,7 +104,7 @@ class ListingEntry implements ArrayAccess
$infos = objects::infos($this->getTemplatedType()); $infos = objects::infos($this->getTemplatedType());
$rights = $ui->get_permissions($this->aclBase, $infos['aclCategory'].'/'.($this->isTemplate() ? 'template' : $infos['mainTab'])); $rights = $ui->get_permissions($this->aclBase, $infos['aclCategory'].'/'.($this->isTemplate() ? 'template' : $infos['mainTab']));
foreach (str_split($acls) as $acl) { foreach (str_split($acls) as $acl) {
if (!str_contains((string) $rights, $acl)) { if (strpos($rights, $acl) === FALSE) {
return FALSE; return FALSE;
} }
} }
...@@ -125,3 +128,4 @@ class ListingEntry implements ArrayAccess ...@@ -125,3 +128,4 @@ class ListingEntry implements ArrayAccess
return $ui->allow_snapshot_restore($this->aclBase, $infos['aclCategory'], FALSE); return $ui->allow_snapshot_restore($this->aclBase, $infos['aclCategory'], FALSE);
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment