system/modules/DocumentManagementSystem/modules/ModuleDmsListing.php
private function applyReadPermissionsToCategories(Array $arrCategories)
	{
		$arrSecureCategories = $arrCategories;
		foreach ($arrSecureCategories as $category)
		{
			if (!$category->isPublished() || ($this->dmsHideEmptyCategories && !$category->hasPublishedDocuments()) || ($this->dmsHideLockedCategories && !$category->isReadableForCurrentMember()))
			{
				unset($arrSecureCategories[$category->id]);
			}
			else if ($category->hasSubCategories())
			{
				$arrSecureSubCategories = $this->applyReadPermissionsToCategories($category->subCategories);
				$category->subCategories = $arrSecureSubCategories;
			}
		}
		return $arrSecureCategories;
	}
private function applyReadPermissionsToCategories(Array $arrCategories)
	{
		$arrSecureCategories = $arrCategories;
		foreach ($arrSecureCategories as $category)
		{
			if (!$category->isPublished() || ($this->dmsHideEmptyCategories && !$category->hasPublishedDocuments()) || ($this->dmsHideLockedCategories && !$category->isReadableForCurrentMember()))
			{
				unset($arrSecureCategories[$category->id]);
			}
			else if ($category->hasSubCategories())
			{
				$arrSecureSubCategories = $this->applyReadPermissionsToCategories($category->subCategories);
				$category->subCategories = $arrSecureSubCategories;
			}
		}
		return $arrSecureCategories;
	}
private function applyReadPermissionsToCategories ( Array $ arrCategories ) { $ arrSecureCategories = $ arrCategories ; foreach ( $ arrSecureCategories as $ category ) { if ( ! $ category -> isPublished ( ) || ( $ this -> dmsHideEmptyCategories && ! $ category -> hasPublishedDocuments ( ) ) || ( $ this -> dmsHideLockedCategories && ! $ category -> isReadableForCurrentMember ( ) ) ) { unset ( $ arrSecureCategories [ $ category -> id ] ) ; } else if ( $ category -> hasSubCategories ( ) ) { $ arrSecureSubCategories = $ this -> applyReadPermissionsToCategories ( $ category -> subCategories ) ; $ category -> subCategories = $ arrSecureSubCategories ; } } return $ arrSecureCategories ; }
Apply the read permissions to the categories.

@param	arr	$arrCategories	The structured array of categories.
@return	array	Returns a reduced array of categories (depends on the read permissions).
Apply the read permissions to the categories .