52 $this->listing = $listing;
56 $this->attrs = $attrs;
60 public function offsetSet ($offset, $value)
62 $this->attrs[$offset] = $value;
65 public function offsetExists ($offset)
67 return isset($this->attrs[$offset]);
70 public function offsetUnset ($offset)
72 unset($this->attrs[$offset]);
75 public function offsetGet ($offset)
77 return (isset($this->attrs[$offset]) ? $this->attrs[$offset] : NULL);
80 public function getPid ():
string 82 return $this->listing->pid;
85 public function isTemplate ():
bool 87 return preg_match(
'/^template_/', $this->type);
90 public function getTemplatedType ():
string 92 return preg_replace(
'/^template_/',
'', $this->type);
95 public function getTemplatedFields (): array
100 public function checkAcl (
string $acls):
bool 104 $infos = objects::infos($this->getTemplatedType());
105 $rights = $ui->get_permissions($this->aclBase, $infos[
'aclCategory'].
'/'.($this->isTemplate() ?
'template' : $infos[
'mainTab']));
106 foreach (str_split($acls) as $acl) {
107 if (strpos($rights, $acl) === FALSE) {
115 public function snapshotCreationAllowed ():
bool 119 $infos = objects::infos($this->getTemplatedType());
120 return $ui->allow_snapshot_create($this->aclBase, $infos[
'aclCategory']);
123 public function snapshotRestoreAllowed ():
bool 127 $infos = objects::infos($this->getTemplatedType());
128 return $ui->allow_snapshot_restore($this->aclBase, $infos[
'aclCategory'], FALSE);
This class handles the entries list for a management instance.
$aclBase
DN to use for ACL checks, usually the same as $dn.
static fieldsFromLDAP(array $template_attrs)
Translate template attrs into $attrs as if taken from LDAP.
$dn
LDAP dn if any, unique id otherwise.