|
@@ 1742-1762 (lines=21) @@
|
| 1739 |
|
* @return HTMLText |
| 1740 |
|
* @throws SS_HTTPResponse_Exception |
| 1741 |
|
*/ |
| 1742 |
|
public function restoresnapshot(SS_HTTPRequest $request) { |
| 1743 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1744 |
|
|
| 1745 |
|
/** @var DNDataArchive $dataArchive */ |
| 1746 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1747 |
|
|
| 1748 |
|
if(!$dataArchive) { |
| 1749 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1750 |
|
} |
| 1751 |
|
|
| 1752 |
|
// We check for canDownload because that implies access to the data. |
| 1753 |
|
// canRestore is later checked on the actual restore action per environment. |
| 1754 |
|
if(!$dataArchive->canDownload()) { |
| 1755 |
|
throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1756 |
|
} |
| 1757 |
|
|
| 1758 |
|
$form = $this->getDataTransferRestoreForm($this->request, $dataArchive); |
| 1759 |
|
|
| 1760 |
|
// View currently only available via ajax |
| 1761 |
|
return $form->forTemplate(); |
| 1762 |
|
} |
| 1763 |
|
|
| 1764 |
|
/** |
| 1765 |
|
* View a form to delete a specific {@link DataArchive}. |
|
@@ 1774-1792 (lines=19) @@
|
| 1771 |
|
* @return HTMLText |
| 1772 |
|
* @throws SS_HTTPResponse_Exception |
| 1773 |
|
*/ |
| 1774 |
|
public function deletesnapshot(SS_HTTPRequest $request) { |
| 1775 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1776 |
|
|
| 1777 |
|
/** @var DNDataArchive $dataArchive */ |
| 1778 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1779 |
|
|
| 1780 |
|
if(!$dataArchive) { |
| 1781 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1782 |
|
} |
| 1783 |
|
|
| 1784 |
|
if(!$dataArchive->canDelete()) { |
| 1785 |
|
throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403); |
| 1786 |
|
} |
| 1787 |
|
|
| 1788 |
|
$form = $this->getDeleteForm($this->request, $dataArchive); |
| 1789 |
|
|
| 1790 |
|
// View currently only available via ajax |
| 1791 |
|
return $form->forTemplate(); |
| 1792 |
|
} |
| 1793 |
|
|
| 1794 |
|
/** |
| 1795 |
|
* @param SS_HTTPRequest $request |
|
@@ 1876-1895 (lines=20) @@
|
| 1873 |
|
* @return HTMLText |
| 1874 |
|
* @throws SS_HTTPResponse_Exception |
| 1875 |
|
*/ |
| 1876 |
|
public function movesnapshot(SS_HTTPRequest $request) { |
| 1877 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1878 |
|
|
| 1879 |
|
/** @var DNDataArchive $dataArchive */ |
| 1880 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1881 |
|
|
| 1882 |
|
if(!$dataArchive) { |
| 1883 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1884 |
|
} |
| 1885 |
|
|
| 1886 |
|
// We check for canDownload because that implies access to the data. |
| 1887 |
|
if(!$dataArchive->canDownload()) { |
| 1888 |
|
throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1889 |
|
} |
| 1890 |
|
|
| 1891 |
|
$form = $this->getMoveForm($this->request, $dataArchive); |
| 1892 |
|
|
| 1893 |
|
// View currently only available via ajax |
| 1894 |
|
return $form->forTemplate(); |
| 1895 |
|
} |
| 1896 |
|
|
| 1897 |
|
/** |
| 1898 |
|
* Build snapshot move form. |