Skip to content
Snippets Groups Projects
Commit af9ea7f0 authored by David Siegfried's avatar David Siegfried
Browse files

check user-permissons, closes #870

parent c1e2d0b9
No related branches found
No related tags found
No related merge requests found
......@@ -1016,7 +1016,6 @@ class Resources_ResourceController extends AuthenticatedController
//Get the list of temporary permissions for the user-IDs in the list:
$user_permissions = Request::getArray('permissions');
//var_dump($user_permissions);die();
$processed_permissions = 0;
$errors = [];
......
......@@ -67,10 +67,7 @@ class Resources_RoomController extends AuthenticatedController
$user,
'autor'
);
$current_user_is_resource_user = $this->room->userHasPermission(
$user,
'user'
);
$current_user_is_resource_user = $this->room->userHasPermission($user);
$sidebar = Sidebar::get();
$actions = new ActionsWidget();
......@@ -167,6 +164,7 @@ class Resources_RoomController extends AuthenticatedController
$this->grouped_properties = $this->room->getGroupedProperties(
$this->room->getRequiredPropertyNames()
);
$this->geo_coordinates_object = $this->room->building->getPropertyObject('geo_coordinates');
}
......
......@@ -55,6 +55,8 @@
);
}
if ($room->building) {
$geo_coordinates_object = $room->building->getPropertyObject('geo_coordinates');
if ($geo_coordinates_object instanceof ResourceProperty) {
$actions->addLink(
ResourceManager::getMapUrlForResourcePosition(
$room->building->getPropertyObject('geo_coordinates')
......@@ -64,6 +66,7 @@
['target' => '_blank']
);
}
}
if ($clipboard_widget_id) {
$actions->addLink(
'#',
......
......@@ -30,7 +30,6 @@
</section>
</section>
<? endif ?>
<div data-dialog-button>
<? if (Request::isDialog()) : ?>
<? if ($geo_coordinates_object instanceof ResourceProperty): ?>
......@@ -40,6 +39,7 @@
['target' => '_blank']
) ?>
<? endif ?>
<? if ($building->userHasPermission($GLOBALS['user']->getAuthenticatedUser(), 'admin')) : ?>
<?= \Studip\LinkButton::createEdit(
_('Bearbeiten'),
$building->getActionURL('edit'),
......@@ -48,6 +48,7 @@
]
) ?>
<? endif ?>
<? endif ?>
</div>
<?
$property_groups = $building->getGroupedProperties(
......
......@@ -19,6 +19,7 @@
['target' => '_blank']
) ?>
</div>
<? if($location->userHasPermission(User::findCurrent(), 'admin')) : ?>
<?= \Studip\LinkButton::createEdit(
_('Bearbeiten'),
$location->getActionURL('edit'),
......@@ -28,6 +29,7 @@
) ?>
<? endif ?>
<? endif ?>
<? endif ?>
<? $property_groups = $location->getGroupedProperties($other_properties) ?>
<? if (count($property_groups)): ?>
<?= $this->render_partial(
......
......@@ -88,14 +88,16 @@
$room->getActionURL('semester_plan'),
['data-dialog' => 'size=big']) ?>
<? endif ?>
<? if ($room->building) : ?>
<? if ($geo_coordinates_object instanceof ResourceProperty): ?>
<?= \Studip\LinkButton::create(
_('Zum Lageplan'),
ResourceManager::getMapUrlForResourcePosition(
$room->building->getPropertyObject('geo_coordinates')
$geo_coordinates_object
)
) ?>
<? endif ?>
<? if ($room->userHasPermission(User::findCurrent(), 'admin')) : ?>
<?= \Studip\LinkButton::createEdit(
_('Bearbeiten'),
$room->getActionURL('edit'),
......@@ -103,6 +105,7 @@
'data-dialog' => 'size=auto'
]
) ?>
<? endif ?>
<? if (!$current_user_is_resource_autor && $room->requestable) : ?>
<?= \Studip\LinkButton::create(
_('Raum anfragen'),
......
......@@ -1439,13 +1439,16 @@ class Resource extends SimpleORMap implements StudipItem
);
$property->store();
if ($name === 'geo_coordinates' && $property->state === '+0.0000000+0.0000000+0.0000000CRSWGS_84/') {
return null;
}
return $property;
} else {
return null;
}
}
return ResourceProperty::findOneBySql(
$property = ResourceProperty::findOneBySql(
"INNER JOIN resource_property_definitions rpd
ON resource_properties.property_id = rpd.property_id
WHERE resource_properties.resource_id = :resource_id
......@@ -1455,6 +1458,11 @@ class Resource extends SimpleORMap implements StudipItem
'name' => $name
]
);
if ($name === 'geo_coordinates' && $property->state === '+0.0000000+0.0000000+0.0000000CRSWGS_84/') {
return null;
}
return $property;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment