Get the groups a computer is in.

@param string $computerName The name of the computer
@param null   $recursive    Whether to check recursively

@return array|bool
963637
public function groups($computerName, $recursive = null)
    {
        if ($recursive === null) {
            $recursive = $this->adldap->getRecursiveGroups();
        }

        $info = $this->find($computerName);

        if (is_array($info) && array_key_exists('memberof', $info)) {
            $groups = $this->adldap->utilities()->niceNames($info['memberof']);

            if ($recursive === true) {
                foreach ($groups as $id => $groupName) {
                    $extraGroups = $this->adldap->group()->recursiveGroups($groupName);

                    $groups = array_merge($groups, $extraGroups);
                }
            }

            return $groups;
        }

        return false;
    }
623938
public function listContents($dirname = '', $recursive = false)
	{
		if ($recursive) {
			throw new BadMethodCallException('Recursive listing is not yet implemented');
		}

		$keys = [];
		$cursor = $this->client->find([
			'filename' => new MongoRegex('/^' . $dirname . '/'),
		]);
		foreach ($cursor as $file) {
			$keys[] = $this->normalizeGridFSFile($file);
		}

		return Util::emulateDirectories($keys);
	}
601324
public function &getChildren($recursive = false)
	{
		if (!$this->_allChildrenloaded)
		{
			$temp = $this->_constructor->get($this->id, true);

			if ($temp)
			{
				$this->_children = $temp->getChildren();
				$this->_leftSibling = $temp->getSibling(false);
				$this->_rightSibling = $temp->getSibling(true);
				$this->setAllLoaded();
			}
		}

		if ($recursive)
		{
			$items = array();

			foreach ($this->_children as $child)
			{
				$items[] = $child;
				$items = array_merge($items, $child->getChildren(true));
			}

			return $items;
		}

		return $this->_children;
	}
657626
private function getGroups($username)
    {
        if (!$this->entityManager) {
            return [];
        }

        $db = $this->entityManager->getConnection();
        $queryBuilder = $db->createQueryBuilder();

        $rows = $queryBuilder
            ->select('g.gName', 'u.uID')->from($db->getDatabasePlatform()->quoteSingleIdentifier('Groups'), 'g')
            ->leftJoin('g', 'UserGroups', 'ug', 'ug.gID=g.gID')
            ->innerJoin('ug', 'Users', 'u', 'ug.uID=u.uID AND (u.uName=? OR u.uEmail=?)')
            ->setParameters([$username, $username])
            ->execute();

        $groups = [];
        $uID = 0;
        foreach ($rows as $row) {
            $uID = (int) $row['uID'];
            $groups[] = $row['gName'];
        }

        if ($uID == USER_SUPER_ID) {
            $groups[] = 'SUPER';
        }

        return $groups;
    }
247967
public function getNumItems($recursive = false)
	{
		if ($recursive)
		{
			$count = $this->numitems;

			foreach ($this->getChildren() as $child)
			{
				$count = $count + $child->getNumItems(true);
			}

			return $count;
		}

		return $this->numitems;
	}
261475
def get_user_groups(name, sid=False):
    '''
    
    '''
    if name == 'SYSTEM':
        # 'win32net.NetUserGetLocalGroups' will fail if you pass in 'SYSTEM'.
        groups = [name]
    else:
        groups = win32net.NetUserGetLocalGroups(None, name)

    if not sid:
        return groups

    ret_groups = set()
    for group in groups:
        ret_groups.add(get_sid_from_name(group))

    return ret_groups
1059645
private function scanFolders(string $dir, bool $recursive): array
    {
        $files = [];

        // $dir comes from the database. The actual folder may not exist.
        if (is_dir($dir)) {
            foreach (scandir($dir, SCANDIR_SORT_NONE) as $path) {
                if (is_dir($dir . $path)) {
                    // What if there are user-defined subfolders “thumbs” or “watermarks”?
                    if ($path !== '.' && $path !== '..' && $path !== 'thumbs' && $path !== 'watermark' && $recursive) {
                        foreach ($this->scanFolders($dir . $path . '/', $recursive) as $subpath) {
                            $files[] = $path . '/' . $subpath;
                        }
                    }
                } else {
                    $files[] = $path;
                }
            }
        }

        return $files;
    }
143258
public function listDir($key = '/', $recursive = false)
    {
        $query = array();
        if ($recursive === true) {
            $query['recursive'] = 'true';
        }
        $response = $this->guzzleclient->get(
            $this->buildKeyUri($key),
            array(
                'query' => $query
            )
        );
        $body = json_decode($response->getBody(), true);
        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new RuntimeException('Unable to parse response body into JSON: ' . json_last_error());
        }

        if (isset($body['errorCode'])) {
            throw new KeyNotFoundException($body['message'], $body['errorCode']);
        }

        return $body;
    }
607727
public function getParentClasses( core_kernel_classes_Class $resource, $recursive = false)
    {
        $returnValue = array();
		
        $sqlQuery = 'SELECT object FROM statements WHERE subject = ?  AND predicate = ?';

		$sqlResult = $this->getPersistence()->query($sqlQuery, array($resource->getUri(), OntologyRdfs::RDFS_SUBCLASSOF));

		while ($row = $sqlResult->fetch()){

            $parentClass = new core_kernel_classes_Class($row['object']);
            
            $returnValue[$parentClass->getUri()] = $parentClass ;
            if ($recursive == true && $parentClass->getUri() != OntologyRdfs::RDFS_CLASS && $parentClass->getUri() != OntologyRdfs::RDFS_RESOURCE) {
                if ($parentClass->getUri() == GenerisRdf::CLASS_GENERIS_RESOURCE) {
                    $returnValue[OntologyRdfs::RDFS_RESOURCE] = new core_kernel_classes_Class(OntologyRdfs::RDFS_RESOURCE);
                } else {
                    $plop = $parentClass->getParentClasses(true);
                	$returnValue = array_merge($returnValue, $plop);
                }
            }
		}

        return $returnValue;
    }
1246706
public function getChildren( $nodeName = NULL )
	{
		if( !$nodeName )
			return $this->children;
		$list	= array();
		for( $i=0; $i<count( $this->children ); $i++ )
			if( $this->children[$i]->getNodeName() == $nodeName )
				$list[]	= $this->children[$i];
		return $list;
	}
1088811
public function findOwners($recursive = true, $list = null)
    {
        if (!$list) {
            $list = new ArrayList();
        }

        // Build reverse lookup for ownership
        // @todo - Cache this more intelligently
        $rules = $this->lookupReverseOwners();

        // Hand off to recursive method
        return $this->findOwnersRecursive($recursive, $list, $rules);
    }
1284783
public function findOwned($recursive = true, $list = null)
    {
        // Find objects in these relationships
        return $this->owner->findRelatedObjects('owns', $recursive, $list);
    }
539395
public function getCurrentModuleDependencies($recursive = false)
    {
        if (empty($this->moduleDescriptor->required)) {
            return [];
        }

        $dependencies = [];
        foreach ($this->moduleDescriptor->required->module as $dependency) {
            $dependencyArray = [
                "code" => (string)$dependency,
                "version" => (string)$dependency['version'],
            ];
            if (!\in_array($dependencyArray, $dependencies)) {
                $dependencies[] = $dependencyArray;
            }

            if ($recursive) {
                $recursiveModuleValidator = new ModuleValidator(THELIA_MODULE_DIR . '/' . (string)$dependency);
                array_merge(
                    $dependencies,
                    $recursiveModuleValidator->getCurrentModuleDependencies(true)
                );
            }
        }

        return $dependencies;
    }
386309
protected function findCommandsIn($path, $recursive = false)
    {
        $classes = [];
        foreach ($this->findCommandsFiles($path) as $filePath) {

            //$class = $classFinder->findClass($filePath);

            $class = Util::getClassNameFromFile($filePath);
            if ($class !== null) {
                $namespace = Util::getNamespaceFromFile($filePath);
                if ($namespace !== null) {
                    $class = "$namespace\\$class";
                }
                $class = Str::removeLeft($class, '\\');
                $parents = class_parents($class);

                if ($this->findCommandsExtending !== null && in_array($this->findCommandsExtending, $parents, true) === false) {
                    continue;
                }
                $ref = new \ReflectionClass($class);
                if ($ref->isAbstract()) {
                    continue;
                }
                $classes[] = Str::removeLeft($class, '\\');
            }
        }

        return $classes;
    }
1220322
public function getMigrationFiles($paths = [], $recursive = true)
    {
        if ($recursive) {
            $paths = $this->getRecursiveFolders($paths);
        }

        $files = parent::getMigrationFiles($paths);

        return $files;
    }
51733
public function getValue($recursive = false)
    {
        $item = $this->data[$this->position][$this->key];

        if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
            $item = $item->value;
        }
        if (!($item = $this->getStub($item)) instanceof Stub) {
            return $item;
        }
        if (Stub::TYPE_STRING === $item->type) {
            return $item->value;
        }

        $children = $item->position ? $this->data[$item->position] : [];

        foreach ($children as $k => $v) {
            if ($recursive && !($v = $this->getStub($v)) instanceof Stub) {
                continue;
            }
            $children[$k] = clone $this;
            $children[$k]->key = $k;
            $children[$k]->position = $item->position;

            if ($recursive) {
                if (Stub::TYPE_REF === $v->type && ($v = $this->getStub($v->value)) instanceof Stub) {
                    $recursive = (array) $recursive;
                    if (isset($recursive[$v->position])) {
                        continue;
                    }
                    $recursive[$v->position] = true;
                }
                $children[$k] = $children[$k]->getValue($recursive);
            }
        }

        return $children;
    }
984288
public function toObject(bool $recursive = false) : \stdClass
    {
        $o = new \stdClass();
        if (!$recursive) {
            foreach ($this->explorableIndex as $property) {
                $o->{$property} = $this->{$property};
            }
        } else {
            foreach ($this->explorableIndex as $property) {
                $value = $this->{$property};
                $o->{$property} = !($value instanceof Explorable) ? $value : $value->toObject(true);
            }
        }
        return $o;
    }