🚑 fix(snapshots) Fix a TypeError in SnashotRestoreDialog

issue #5715
parent e9490320
......@@ -1087,19 +1087,19 @@ class management
if (empty($action['targets'])) {
// No target, open the restore removed object dialog.
$this->currentDn = $this->listing->getBase();
$aclCategory = $this->listAclCategories();
$aclCategories = $this->listAclCategories();
} else {
// Display the restore points for a given object.
$this->currentDn = $action['targets'][0];
if (empty($this->currentDn)) {
return;
}
$aclCategory = objects::infos($this->listing->getEntry($this->currentDn)->getTemplatedType())['aclCategory'];
$aclCategories = [objects::infos($this->listing->getEntry($this->currentDn)->getTemplatedType())['aclCategory']];
}
if ($ui->allow_snapshot_restore($this->currentDn, $aclCategory, empty($action['targets']))) {
if ($ui->allow_snapshot_restore($this->currentDn, $aclCategories, empty($action['targets']))) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Snapshot restoring initiated!');
$this->dialogObject = new SnapshotRestoreDialog($this->currentDn, $this, empty($action['targets']), $aclCategory);
$this->dialogObject = new SnapshotRestoreDialog($this->currentDn, $this, empty($action['targets']), $aclCategories);
} else {
msg_dialog::display(_('Permission'), sprintf(_('You are not allowed to restore a snapshot for %s.'), $this->currentDn),
ERROR_DIALOG);
......
......@@ -60,13 +60,13 @@ class SnapshotRestoreDialog extends ManagementDialog
];
}
function __construct (string $dn, management $parent, bool $global, string $aclCategory)
function __construct (string $dn, management $parent, bool $global, array $aclCategories)
{
$this->global = $global;
parent::__construct(NULL, NULL, $parent);
$this->object_dn = $dn;
$this->acl_base = $dn;
$this->aclCategory = $aclCategory;
$this->aclCategory = $aclCategories;
if ($this->global) {
$this->attributesAccess['object_dn']->setVisible(FALSE);
}
......
......@@ -1152,19 +1152,19 @@ class simpleManagement
if (!count($target)) {
// No target, open the restore removed object dialog.
$this->dn = $this->headpage->getBase();
$aclCategory = $this->headpage->categories;
$aclCategories = $this->headpage->categories;
} else {
// Display the restore points for a given object.
$this->dn = $target[0];
if (empty($this->dn)) {
return;
}
$aclCategory = $config->data['OBJECTS'][$this->getType($this->dn)]['aclCategory'];
$aclCategories = [$config->data['OBJECTS'][$this->getType($this->dn)]['aclCategory']];
}
if ($ui->allow_snapshot_restore($this->dn, $aclCategory, !count($target))) {
if ($ui->allow_snapshot_restore($this->dn, $aclCategories, !count($target))) {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'Snapshot restoring initiated!');
$this->dialogObject = new SnapshotRestoreDialog($this->dn, $this, !count($target), $aclCategory);
$this->dialogObject = new SnapshotRestoreDialog($this->dn, $this, !count($target), $aclCategories);
} else {
msg_dialog::display(_('Permission'), sprintf(_('You are not allowed to restore a snapshot for %s.'), $this->dn),
ERROR_DIALOG);
......
Markdown is supported
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