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