Not showing AddressDB menu if user does not own gwr Network
This commit is contained in:
@@ -40,13 +40,14 @@
|
||||
if($building->network_id == $network->id):
|
||||
echo "selected='selected'";
|
||||
endif;
|
||||
else:
|
||||
elseif($request_network_id):
|
||||
if($request_network_id == $network->id):
|
||||
echo "selected='selected'";
|
||||
endif;
|
||||
elseif(count($networks) == 1):
|
||||
echo "selected='selected'";
|
||||
endif;
|
||||
?>><?=($network->name)?></option>
|
||||
endif;
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($me->is(["Admin", "netowner"])): ?>
|
||||
<?php if($me->is(["Admin"]) || ($me->is("netowner") && $me->hasGwrNetworks())): ?>
|
||||
<li class="has-submenu">
|
||||
<a href="#">
|
||||
<i class="far fa-database"></i>Stammdaten <div class="arrow-down"></div>
|
||||
@@ -51,7 +51,7 @@
|
||||
<li class="has-sub-submenu"><a href="<?=self::getUrl("User")?>"><i class="fad fa-users text-info"></i> Benutzer</a></li>
|
||||
<li class="has-sub-submenu font-weight-bold mt-1"><a>Grundstammdaten</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($me->is(["Admin", "netowner"])): ?>
|
||||
<?php if($me->is(["Admin"]) || ($me->is("netowner") && $me->hasGwrNetworks())): ?>
|
||||
<li><a href="<?=self::getUrl("AddressDB")?>"><i class="fas fa-city text-info"></i> GWR / AddressDB</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($me->is(["Admin"])): ?>
|
||||
|
||||
@@ -260,6 +260,14 @@ class User extends mfBaseModel {
|
||||
return $typenets;
|
||||
}
|
||||
|
||||
public function hasGwrNetworks() {
|
||||
$my_networks = $this->myNetworks(["netowner"]);
|
||||
foreach($my_networks as $network) {
|
||||
if($network->adb_netzgebiet_id) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function getMyNetworks() {
|
||||
if(!$this->id) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user