• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. iteixido
    3. Best
    I
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 3
    • Best 1
    • Controversial 0
    • Groups 0

    Best posts made by iteixido

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

      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!

      posted in Bug Reports
      I
      iteixido
    • 1 / 1