@@ 1753-1773 (lines=21) @@ | ||
1750 | * @return HTMLText |
|
1751 | * @throws SS_HTTPResponse_Exception |
|
1752 | */ |
|
1753 | public function restoresnapshot(\SS_HTTPRequest $request) { |
|
1754 | $this->setCurrentActionType(self::ACTION_SNAPSHOT); |
|
1755 | ||
1756 | /** @var DNDataArchive $dataArchive */ |
|
1757 | $dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
|
1758 | ||
1759 | if (!$dataArchive) { |
|
1760 | throw new SS_HTTPResponse_Exception('Archive not found', 404); |
|
1761 | } |
|
1762 | ||
1763 | // We check for canDownload because that implies access to the data. |
|
1764 | // canRestore is later checked on the actual restore action per environment. |
|
1765 | if (!$dataArchive->canDownload()) { |
|
1766 | throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
|
1767 | } |
|
1768 | ||
1769 | $form = $this->getDataTransferRestoreForm($this->request, $dataArchive); |
|
1770 | ||
1771 | // View currently only available via ajax |
|
1772 | return $form->forTemplate(); |
|
1773 | } |
|
1774 | ||
1775 | /** |
|
1776 | * View a form to delete a specific {@link DataArchive}. |
|
@@ 1785-1803 (lines=19) @@ | ||
1782 | * @return HTMLText |
|
1783 | * @throws SS_HTTPResponse_Exception |
|
1784 | */ |
|
1785 | public function deletesnapshot(\SS_HTTPRequest $request) { |
|
1786 | $this->setCurrentActionType(self::ACTION_SNAPSHOT); |
|
1787 | ||
1788 | /** @var DNDataArchive $dataArchive */ |
|
1789 | $dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
|
1790 | ||
1791 | if (!$dataArchive) { |
|
1792 | throw new SS_HTTPResponse_Exception('Archive not found', 404); |
|
1793 | } |
|
1794 | ||
1795 | if (!$dataArchive->canDelete()) { |
|
1796 | throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403); |
|
1797 | } |
|
1798 | ||
1799 | $form = $this->getDeleteForm($this->request, $dataArchive); |
|
1800 | ||
1801 | // View currently only available via ajax |
|
1802 | return $form->forTemplate(); |
|
1803 | } |
|
1804 | ||
1805 | /** |
|
1806 | * @param \SS_HTTPRequest $request |
|
@@ 1887-1906 (lines=20) @@ | ||
1884 | * @return HTMLText |
|
1885 | * @throws SS_HTTPResponse_Exception |
|
1886 | */ |
|
1887 | public function movesnapshot(\SS_HTTPRequest $request) { |
|
1888 | $this->setCurrentActionType(self::ACTION_SNAPSHOT); |
|
1889 | ||
1890 | /** @var DNDataArchive $dataArchive */ |
|
1891 | $dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
|
1892 | ||
1893 | if (!$dataArchive) { |
|
1894 | throw new SS_HTTPResponse_Exception('Archive not found', 404); |
|
1895 | } |
|
1896 | ||
1897 | // We check for canDownload because that implies access to the data. |
|
1898 | if (!$dataArchive->canDownload()) { |
|
1899 | throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
|
1900 | } |
|
1901 | ||
1902 | $form = $this->getMoveForm($this->request, $dataArchive); |
|
1903 | ||
1904 | // View currently only available via ajax |
|
1905 | return $form->forTemplate(); |
|
1906 | } |
|
1907 | ||
1908 | /** |
|
1909 | * Build snapshot move form. |