diff --git a/controllers/myplugins.php b/controllers/myplugins.php index b3a5ecff53759f1e1e3f759be54e28a33b6e98c9..a935ece3dc76cdfdc4ce024440bb09020ea1bdfe 100644 --- a/controllers/myplugins.php +++ b/controllers/myplugins.php @@ -45,6 +45,10 @@ class MypluginsController extends PluginController { public function edit_release_action($release_id) { $this->release = new MarketRelease($release_id); + $this->marketplugin = new MarketPlugin(Request::option("plugin_id") ?: null); + if (!$this->marketplugin->isNew() && !$this->marketplugin->isWritable()) { + throw new AccessDeniedException("Kein Zugriff"); + } if (Request::isXhr()) { $this->response->add_header('X-Title', _("Release bearbeiten")); $this->set_layout(null); @@ -139,6 +143,12 @@ class MypluginsController extends PluginController { throw new Exception("Method not allowed. Try a POST request."); } $this->release = new MarketRelease(Request::option("id")); + $this->release['plugin_id'] = Request::option("plugin_id"); + $this->release['user_id'] = $GLOBALS['user']->id; + $this->marketplugin = new MarketPlugin(Request::option("plugin_id") ?: null); + if (!$this->marketplugin->isNew() && !$this->marketplugin->isWritable()) { + throw new AccessDeniedException("Kein Zugriff"); + } $release_data = Request::getArray("release"); $this->release->setData($release_data); if ($release_data['type'] === "zipfile") { diff --git a/plugin.manifest b/plugin.manifest index e86098cc01ded0102b951d1c6f6c7597297f0684..d9e5f90e7c3604255e1d599ce552b3bff2c47fa8 100644 --- a/plugin.manifest +++ b/plugin.manifest @@ -1,4 +1,4 @@ pluginname=PluginMarktplatz pluginclassname=PluginMarket origin=studip -version=1.0.3 \ No newline at end of file +version=1.0.4 \ No newline at end of file diff --git a/views/myplugins/edit_release.php b/views/myplugins/edit_release.php index 5fcae4a0f8d496a20c817aa2e1192e139e471497..5122f3ad83da2de7bbf449160c0d1b70434915f8 100644 --- a/views/myplugins/edit_release.php +++ b/views/myplugins/edit_release.php @@ -1,5 +1,6 @@ <form action="<?= PluginEngine::getLink($plugin, array(), "myplugins/save_release") ?>" method="post" class="studip_form" enctype="multipart/form-data"> <input type="hidden" name="id" value="<?= $release->getId() ?>"> + <input type="hidden" name="plugin_id" value="<?= $marketplugin->getId() ?>"> <?= $this->render_partial("myplugins/_edit_release.php", array('release' => $release)) ?> <div data-dialog-button> diff --git a/views/presenting/details.php b/views/presenting/details.php index c2fa0ac06a6f91192e10c4ec49763960ec0d9012..eb1e614461e2aa7f1b3fdcd94c72ca5f5d8a1008 100644 --- a/views/presenting/details.php +++ b/views/presenting/details.php @@ -110,7 +110,7 @@ if ($icon) { <td><?= htmlReady($release->getChecksum()) ?></td> <td><?= htmlReady($release['downloads']) ?></td> <td> - <? if ($marketplugin['user_id'] === $GLOBALS['user']->id) : ?> + <? if ($marketplugin->isWritable()) : ?> <a href="<?= PluginEngine::getLink($plugin, array(), "myplugins/edit_release/".$release->getId()) ?>" data-dialog> <?= Assets::img("icons/20/blue/edit", array('class' => "text-bottom")) ?> </a> @@ -124,6 +124,17 @@ if ($icon) { </tr> <? endforeach ?> </tbody> + <? if ($marketplugin->isWritable()) : ?> + <tfoot> + <tr> + <td colspan="6"> + <a href="<?= PluginEngine::getLink($plugin, array('plugin_id' => $marketplugin->getId()), "myplugins/add_release/".$marketplugin->getId()) ?>" data-dialog> + <?= Assets::img("icons/20/blue/add") ?> + </a> + </td> + </tr> + </tfoot> + <? endif ?> </table> @@ -249,6 +260,6 @@ if ($icon) { <? if ($marketplugin->isWritable()) : ?> <div style="text-align: center"> <?= \Studip\LinkButton::create(_("bearbeiten"), PluginEngine::getURL($plugin, array(), "myplugins/edit/".$marketplugin->getId()), array('data-dialog' => 1)) ?> - <?= \Studip\LinkButton::create(_("Release hinzuf�gen"), PluginEngine::getURL($plugin, array(), "myplugins/add_release/".$marketplugin->getId()), array('data-dialog' => 1)) ?> + <?= \Studip\LinkButton::create(_("Release hinzuf�gen"), PluginEngine::getURL($plugin, array('plugin_id' => $marketplugin->getId()), "myplugins/add_release/".$marketplugin->getId()), array('data-dialog' => 1)) ?> </div> <? endif ?> \ No newline at end of file