diff --git a/PluginMarket.class.php b/PluginMarket.class.php index 8075546ef685b90fadcced8ebf355e227bf98e66..c47badfb2786945fb2d648496237fa1bcdb456fe 100755 --- a/PluginMarket.class.php +++ b/PluginMarket.class.php @@ -41,7 +41,7 @@ class PluginMarket extends StudIPPlugin implements SystemPlugin, HomepagePlugin } } } - if ($GLOBALS['perm']->have_perm("root")) { + if (RolePersistence::isAssignedRole($GLOBALS['user']->id, "Pluginbeauftragter")) { $approving = new Navigation(_("Qualit�tssicherung"), PluginEngine::getURL($this, array(), "approving/overview")); $top->addSubNavigation("approving", $approving); } diff --git a/classes/MarketPlugin.class.php b/classes/MarketPlugin.class.php index 9a6960ae61d25d1ab6d9ca8f005edcf9826e1093..1f40f62582f0e1bd9d0ead099565bd7f2962caaa 100755 --- a/classes/MarketPlugin.class.php +++ b/classes/MarketPlugin.class.php @@ -51,9 +51,16 @@ class MarketPlugin extends SimpleORMap { public function requestReview() { if ($this->content['publiclyvisible'] && !$this->content_db['publiclyvisible'] && !$this['approved']) { $messaging = new messaging(); - foreach (User::findByPerms("root") as $rootuser) { + $statement = DBManager::get()->prepare(" + SELECT roles_user.user_id + FROM roles + INNER JOIN roles_user ON (roles.roleid = roles_user.roleid) + WHERE roles.rolename = 'Pluginbeauftragter' + "); + $statement->execute(); + foreach ($statement->fetchAll(PDO::FETCH_COLUMN, 0) as $beauftragter) { $messaging->sendSystemMessage( - $rootuser['user_id'], + $beauftragter, sprintf(_("Plugin %s braucht ein Review"), $this['name']), _("Auf dem Marktplatz wurde ein neues Plugin �ffentlich geschaltet. Es kann allerdings erst �ffentlich auf dem Marktplatz erscheinen, wenn Sie das Plugin einmal reviewt haben und freischalten. Gehen Sie auf den Pluginmarktplatz und den Reiter 'Qualit�tssicherung'.") ); @@ -63,12 +70,13 @@ class MarketPlugin extends SimpleORMap { public function isWritable($user_id = null) { $user_id || $user_id = $GLOBALS['user']->id; - return ($this['user_id'] === $user_id) || $GLOBALS['perm']->have_perm("root", $user_id); + return ($this['user_id'] === $user_id) || $this->isRootable($user_id); } public function isRootable($user_id = null) { $user_id || $user_id = $GLOBALS['user']->id; - return $GLOBALS['perm']->have_perm("root", $user_id); + return $GLOBALS['perm']->have_perm("root", $user_id) + || RolePersistence::isAssignedRole($user_id, "Pluginbeauftragter"); } public function getLogoURL($absolute_url = false) diff --git a/classes/MarketPluginUsage.php b/classes/MarketPluginUsage.php index 2a5530e7e23c4a46ff766b69b71f8ef4fae32ecd..9bbf82b51d52b23de68c18ac9518ba9fa83ba0e2 100755 --- a/classes/MarketPluginUsage.php +++ b/classes/MarketPluginUsage.php @@ -32,7 +32,10 @@ class MarketPluginUsage extends SimpleORMap } public function isEditable() { - return $GLOBALS['perm']->have_perm('root') || $this->user_id == User::findCurrent() || $this->plugin->user_id == User::findCurrent()->id; + return $GLOBALS['perm']->have_perm('root') + || $this->user_id == User::findCurrent() + || $this->plugin->user_id == User::findCurrent()->id + || RolePersistence::isAssignedRole(User::findCurrent()->id, "Pluginbeauftragter"); } } diff --git a/controllers/approving.php b/controllers/approving.php index d0cfa3685e414c911a842a36cecbc08971715682..8573e319d6505c3b21ae85f45060f64478245fa1 100755 --- a/controllers/approving.php +++ b/controllers/approving.php @@ -7,7 +7,7 @@ class ApprovingController extends MarketController function before_filter(&$action, &$args) { parent::before_filter($action, $args); - if (!$GLOBALS['perm']->have_perm("root")) { + if (!RolePersistence::isAssignedRole($GLOBALS['user']->id, "Pluginbeauftragter")) { throw new AcessDeniedException("Kein Zutritt"); } diff --git a/migrations/06_add_moderator_role.php b/migrations/06_add_moderator_role.php new file mode 100755 index 0000000000000000000000000000000000000000..45f7ce937d293d5d7f96faafc5adc935111c6b2f --- /dev/null +++ b/migrations/06_add_moderator_role.php @@ -0,0 +1,17 @@ +<?php + +class AddModeratorRole extends Migration { + + public function up() { + + DBManager::get()->exec(" + INSERT IGNORE INTO `roles` (`rolename`, `system`) + VALUES + ('Pluginbeauftragter', 'n'); + "); + } + + public function down() { + } + +}