/**
  * Lazy loader for `membership` relation
  */
 private function getInnerAdapters()
 {
     if (!isset($this->innerAdapters)) {
         $this->innerAdapters = array();
         $this->groups = $this->platform->getDatabase('accounts')->getAll('group');
         // Get an identity adapter for each group that points to the Members prop.
         foreach ($this->groups as $keyName => $props) {
             $this->innerAdapters[$keyName] = $this->platform->getIdentityAdapter('accounts', $keyName, 'Members', ',');
         }
     }
     return $this->innerAdapters;
 }
Пример #2
0
 public function __construct(\Nethgui\System\PlatformInterface $platform)
 {
     $this->platform = $platform;
     # Search for installed provider
     if (file_exists('/usr/libexec/nethserver/ldap-list-users')) {
         $this->listUsersCommand = '/usr/libexec/nethserver/ldap-list-users';
     } else {
         if (file_exists('/usr/libexec/nethserver/ad-list-users')) {
             $this->listUsersCommand = '/usr/libexec/nethserver/ad-list-users';
         }
     }
     $this->ad = $platform->getDatabase('configuration')->getProp('sssd', 'Provider') === 'ad';
 }
 private function addSearchRoles(\Nethgui\System\PlatformInterface $platform, $text)
 {
     $tmp = array();
     foreach ($platform->getDatabase('networks')->getAll() as $key => $props) {
         if (isset($props['role'])) {
             $tmp[$props['role']] = '';
         }
     }
     $ovpn = $platform->getDatabase('configuration')->getProp('openvpn', 'status');
     $ivpn = $platform->getDatabase('configuration')->getProp('ipsec', 'status');
     if ($ovpn || $ivpn) {
         $tmp['vpn'] = '';
     }
     $roles = array_filter(array_diff(array_keys($tmp), array('bridged', 'alias', 'slave')));
     foreach ($roles as $role) {
         if (!$text || strstr($role, strtolower($text)) !== FALSE) {
             $this->results->append(new \NethServer\Tool\FirewallObject($role, 'role', array(), $this->translator));
         }
     }
 }