• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    [Sites plugin] Sites shown when adding or editing a host

    Scheduled Pinned Locked Moved
    Bug Reports
    4
    4
    409
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I
      iteixido
      last edited by iteixido

      Hi!
      I have installed Fog 1.5.8 with the Sites plugin.
      When an unprivileged user tries to add or edit a host, the site selection box shows all sites, not just the sites of which the user is a part.
      It would be great if only the sites to which the user belongs are displayed.

      I have implemented it by adding the following code to line 262 of the file /var/www/html/fog/lib/plugins/site/hooks/addsitehost.hook.php

      $UserIsRestricted = self::getSubObjectIDs(
          'SiteUserRestriction',
          array('userID' => self::$FOGUser->get('id')),
          'isRestricted'
      )[0];
      if ($UserIsRestricted == 1) {
          $SitesFiltered = array_diff(
              self::getSubObjectIDs(
                  'Site',
                  '',
                  'id'
              ),
              self::getSubObjectIDs(
                  'SiteUserAssociation',
                  array('userID' => self::$FOGUser->get('id')),
                  'siteID'
              )
          );
      } else {
          $SitesFiltered = '';
      }
      

      And modifying lines 284 of the file /var/www/html/fog/lib/plugins/site/hooks/addsitehost.hook.php by:

      $sID,
      '',
      'name',
      $SitesFiltered
      

      Thanks!

      1 Reply Last reply Reply Quote 1
      • F
        Fernando Gietz Developer
        last edited by

        Thanks @iteixido ! We will fix the bug as soon as possible

        1 Reply Last reply Reply Quote 0
        • S
          Sebastian Roth Moderator
          last edited by

          @iteixido Thanks for your request and as well thanks to @Fernando-Gietz for adding this so quickly. I just merged this into dev-branch.

          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

          1 Reply Last reply Reply Quote 0
          • S
            seribe
            last edited by

            Hi,
            I’m a new user of FOG and I start to use also this plugin ( I modifying the code like itexido suggested and works fine).

            But I have the following problem or maybe a bad configuration.
            When restricted user creates a host and associated it with a site and when he tried to list the hosts that host is not listed. I need to log in with the administrator profile to re-add the host to the site and after that the host is listed with restricted user
            Thanks

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post

            255

            Online

            12.0k

            Users

            17.3k

            Topics

            155.2k

            Posts
            Copyright © 2012-2024 FOG Project