32 protected $snapAction;
34 static function plInfo (): array
37 'plShortName' =>
'SnapshotRestoreDialog',
41 static function getAttributesInfo (): array
45 'name' => _(
'Restoring snapshots'),
46 'class' => [
'fullwidth'],
49 _(
'Object'), _(
'DN of the object you are creating a snapshot of'),
53 _(
'Snapshots'), _(
'Existing snapshots for this object'),
65 $this->global = $global;
66 parent::__construct(NULL, NULL, $parent);
67 $this->object_dn =
$dn;
68 $this->aclCategory = $aclCategories;
70 $this->attributesAccess[
'object_dn']->setVisible(FALSE);
75 function getAclBase (
bool $callParent = TRUE):
string 77 return $this->object_dn;
80 function updateList ()
83 $this->snapshots = $this->parent->getAllDeletedSnapshots();
85 $this->snapshots = $this->parent->getAvailableSnapsShots($this->object_dn);
92 if ($this->dialog ==
'delete') {
96 'dn' => $this->snapDn,
97 'icon' =>
'geticon.php?context=actions&icon=document-restore&size=16',
104 $smarty->assign(
'objects', $objects);
106 } elseif ($this->dialog ==
'restore') {
109 'name' =>
'snapshot',
110 'dn' => $this->snapDn,
111 'icon' =>
'geticon.php?context=actions&icon=document-restore&size=16',
118 $smarty->assign(
'objects', $objects);
122 $permissions = $ui->get_snapshot_permissions($this->getAclBase(), $this->aclCategory);
124 if (in_array(
'r', $permissions)) {
127 if (in_array(($this->global ?
'restore_deleted' :
'restore_over'), $permissions)) {
130 if (in_array(
'd', $permissions)) {
133 $smarty->assign(
'SnapshotHandlerACL', $acl);
134 $str = parent::render();
135 $str .=
'<p class="plugbottom">'.
136 ' <input type="submit" formnovalidate="formnovalidate" name="'.$this->post_cancel.
'" value="'.
msgPool::backButton().
'"/>'.
147 if (!is_object($attr)) {
148 $attr = $this->attributesAccess[$attr];
150 if ($attr->getLdapName() ==
'snapshots') {
151 return in_array(($this->global ?
'restore_deleted' :
'restore_over'), $ui->get_snapshot_permissions($this->getAclBase(), $this->aclCategory));
153 return parent::attrIsWriteable($attr);
157 function triggerRestore ($dn)
159 $this->dialog =
'restore';
163 function triggerDelete ($dn)
165 $this->dialog =
'delete';
171 if ($this->dialog ==
'delete') {
172 if (isset($_POST[
'delete_confirmed'])) {
173 $this->parent->removeSnapshot($this->snapDn);
174 $this->closeDialog();
175 } elseif (isset($_POST[
'delete_cancel'])) {
176 $this->closeDialog();
178 } elseif ($this->dialog ==
'restore') {
179 if (isset($_POST[
'restore_confirmed'])) {
180 $this->parent->restoreSnapshot($this->snapDn);
181 $this->closeDialog();
182 } elseif (isset($_POST[
'restore_cancel'])) {
183 $this->closeDialog();
190 function closeDialog ()
192 parent::closeDialog();
193 $this->snapDn = NULL;
$parent
Reference to parent object.
readPost()
Interpret POST content.
get_template_path($filename='', $plugin=FALSE, $path='')
Return themed path for specified base file.
$dn
dn of the opened object
render()
Render the dialog and returns the HTML code.
save()
Save data to the LDAP and return errors.
Attribute which list the snapshots.
Snapshot restoration dialog.
& get_smarty()
Get global smarty object.
attrIsWriteable($attr)
Check if logged in user have enough right to write this attribute value.
This class allow to display a text in front of an attribute.
static backButton($escape=TRUE)
Text for a back button.