aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Noack <noack@data-quest.de>2023-07-17 16:04:58 +0000
committerAndré Noack <noack@data-quest.de>2023-07-17 16:04:58 +0000
commit6e7632d1568059b9374fe6b8ad47156fb41f0e04 (patch)
treecd14bb657e20777ca7540ea5b17999c748fa7541
parentd91899f25d1e3aace6e1b8793b2894f5aef36345 (diff)
Resolve #2856 "Belegungspläne sind für Stud.IP Benutzer nur sichtbar, wenn die Pläne auch öffentlich gemacht werden"
Closes #2856 Merge request studip/studip!1974
-rw-r--r--app/controllers/resources/admin.php5
-rw-r--r--app/views/resources/admin/configuration.php8
-rw-r--r--app/views/resources/search/rooms.php3
-rw-r--r--db/migrations/5.1.50_fix_for_biest2856.php29
-rw-r--r--lib/models/resources/Room.class.php4
5 files changed, 32 insertions, 17 deletions
diff --git a/app/controllers/resources/admin.php b/app/controllers/resources/admin.php
index 2f6e34e..f5834b3 100644
--- a/app/controllers/resources/admin.php
+++ b/app/controllers/resources/admin.php
@@ -1149,11 +1149,6 @@ class Resources_AdminController extends AuthenticatedController
(bool)Request::get('resources_enable')
);
$this->config->store(
- 'RESOURCES_ALLOW_VIEW_RESOURCE_OCCUPATION',
- (bool)Request::get('resources_allow_view_resource_occupation')
- );
-
- $this->config->store(
'RESOURCES_ALLOW_ROOM_PROPERTY_REQUESTS',
(bool)Request::get('resources_allow_room_property_requests')
);
diff --git a/app/views/resources/admin/configuration.php b/app/views/resources/admin/configuration.php
index 23ade8d..5fb3e89 100644
--- a/app/views/resources/admin/configuration.php
+++ b/app/views/resources/admin/configuration.php
@@ -14,14 +14,6 @@
</fieldset>
<fieldset>
<legend><?= _('Anzeigeoptionen') ?></legend>
- <label>
- <input type="checkbox" name="resources_allow_view_resource_occupation"
- value="1"
- <?= $config->RESOURCES_ALLOW_VIEW_RESOURCE_OCCUPATION == '1'
- ? 'checked="checked"'
- : ''?>>
- <?= _('Belegungen sind sichtbar für alle Nutzer') ?>
- </label>
<? if ($colours): ?>
<? foreach ($colours as $colour): ?>
<label>
diff --git a/app/views/resources/search/rooms.php b/app/views/resources/search/rooms.php
index d35f030..1149a19 100644
--- a/app/views/resources/search/rooms.php
+++ b/app/views/resources/search/rooms.php
@@ -47,8 +47,7 @@
Icon::create('info-circle'),
['data-dialog' => '']
);
- if (($room->booking_plan_is_public && Config::get()->RESOURCES_SHOW_PUBLIC_ROOM_PLANS)
- || ($room->userHasPermission($current_user, 'autor'))) {
+ if ($room->bookingPlanVisibleForUser($current_user)) {
$actions->addLink(
$room->getActionURL('booking_plan', $booking_plan_action_params),
(
diff --git a/db/migrations/5.1.50_fix_for_biest2856.php b/db/migrations/5.1.50_fix_for_biest2856.php
new file mode 100644
index 0000000..b6aea95
--- /dev/null
+++ b/db/migrations/5.1.50_fix_for_biest2856.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * @see https://gitlab.studip.de/studip/studip/-/issues/2856
+ */
+final class FixForBiest2856 extends Migration
+{
+ public function description()
+ {
+ return 'Removes the obsolete configuration RESOURCES_ALLOW_VIEW_RESOURCE_OCCUPATION';
+ }
+
+ protected function up()
+ {
+ $query = "DELETE `config`, `config_values`
+ FROM `config`
+ LEFT JOIN `config_values` USING (`field`)
+ WHERE `field` = 'RESOURCES_ALLOW_VIEW_RESOURCE_OCCUPATION'";
+ DBManager::get()->exec($query);
+ }
+
+ protected function down()
+ {
+ $query = "INSERT INTO `config` (`field`, `value`, `type`, `range`, `section`, `mkdate`, `chdate`, `description`)
+ VALUES ('RESOURCES_ALLOW_VIEW_RESOURCE_OCCUPATION', '1', 'boolean', 'global', 'resources', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 'Dürfen alle Nutzer Ressourcenbelegungen einsehen?')";
+ DBManager::get()->exec($query);
+ }
+}
+
+
diff --git a/lib/models/resources/Room.class.php b/lib/models/resources/Room.class.php
index 1c9a0e4..2cea825 100644
--- a/lib/models/resources/Room.class.php
+++ b/lib/models/resources/Room.class.php
@@ -647,8 +647,8 @@ class Room extends Resource
*/
public function bookingPlanVisibleForUser(?User $user, $time_range = [])
{
- return parent::bookingPlanVisibleForUser($user, $time_range)
- || $this->booking_plan_is_public && Config::get()->RESOURCES_SHOW_PUBLIC_ROOM_PLANS;
+ return $this->booking_plan_is_public
+ || parent::bookingPlanVisibleForUser($user, $time_range);
}