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!