Skip to content
Snippets Groups Projects
Select Git revision
  • d4927ddbf3a65892d7fd33eaa6ae97bcf17cfc34
  • main default protected
  • step-3263
  • feature/plugins-cli
  • feature/vite
  • step-2484-peerreview
  • biest/issue-5051
  • tests/simplify-jsonapi-tests
  • fix/typo-in-1a70031
  • feature/broadcasting
  • database-seeders-and-factories
  • feature/peer-review-2
  • feature-feedback-jsonapi
  • feature/peerreview
  • feature/balloon-plus
  • feature/stock-images-unsplash
  • tic-2588
  • 5.0
  • 5.2
  • biest/unlock-blocks
  • biest-1514
21 results

User.class.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ResourceNavigation.php 11.99 KiB
    <?php
    
    /**
     * ResourceNavigation.php - Room management area navigation class
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License as
     * published by the Free Software Foundation; either version 2 of
     * the License, or (at your option) any later version.
     *
     * @author      Moritz Strohm
     * @license     http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
     * @copyright   2017
     * @category    Stud.IP
     * @since       TODO
     */
    
    
    /**
     * This navigagion class provides all standard navigation items for the
     * room management.
     */
    class ResourceNavigation extends Navigation
    {
        public function __construct()
        {
            parent::__construct(_('Raumverwaltung'));
        }
    
    
        public function initItem()
        {
            $user = User::findCurrent();
            if (ResourceManager::userHasGlobalPermission($user, 'user')) {
                $this->setURL('dispatch.php/room_management/overview/index');
            } else {
                $this->setURL('dispatch.php/room_management/overview/rooms');
            }
            $this->setImage(
                Icon::create('resources', 'navigation', ['title' => _('Raumverwaltung')])
            );
        }
    
        public function initSubNavigation()
        {
            $user = User::findCurrent();
            $show_global_admin_actions = ResourceManager::userHasGlobalPermission(
                $user,
                'admin'
            );
            //Check if the user has permissions one at lease one room:
            $user_has_rooms = RoomManager::userHasRooms($user);
    
            $user_is_global_resource_user = ResourceManager::userHasGlobalPermission($user, 'user');
            if (!$show_global_admin_actions && !$user_has_rooms && !$user_is_global_resource_user) {
                return;
            }
            $user_is_global_resource_autor = ResourceManager::userHasGlobalPermission($user, 'autor');
    
            parent::initSubNavigation();
    
            //Overview tab:
    
            if ($show_global_admin_actions) {
                $overview_navigation = new Navigation(
                    _('Übersicht'),
                    'dispatch.php/room_management/overview/index'
                );
                $this->addSubNavigation('overview', $overview_navigation);
            } else {