news-bundle/src/Resources/contao/modules/ModuleNews.php
protected function sortOutProtected($arrArchives)
	{
		if (empty($arrArchives) || !\is_array($arrArchives))
		{
			return $arrArchives;
		}

		$this->import(FrontendUser::class, 'User');
		$objArchive = NewsArchiveModel::findMultipleByIds($arrArchives);
		$arrArchives = array();

		if ($objArchive !== null)
		{
			while ($objArchive->next())
			{
				if ($objArchive->protected)
				{
					if (!FE_USER_LOGGED_IN || !\is_array($this->User->groups))
					{
						continue;
					}

					$groups = StringUtil::deserialize($objArchive->groups);

					if (empty($groups) || !\is_array($groups) || !\count(array_intersect($groups, $this->User->groups)))
					{
						continue;
					}
				}

				$arrArchives[] = $objArchive->id;
			}
		}

		return $arrArchives;
	}
protected function sortOutProtected($arrArchives)
	{
		if (empty($arrArchives) || !\is_array($arrArchives))
		{
			return $arrArchives;
		}

		$this->import(FrontendUser::class, 'User');
		$objArchive = NewsArchiveModel::findMultipleByIds($arrArchives);
		$arrArchives = array();

		if ($objArchive !== null)
		{
			while ($objArchive->next())
			{
				if ($objArchive->protected)
				{
					if (!FE_USER_LOGGED_IN || !\is_array($this->User->groups))
					{
						continue;
					}

					$groups = StringUtil::deserialize($objArchive->groups);

					if (empty($groups) || !\is_array($groups) || !\count(array_intersect($groups, $this->User->groups)))
					{
						continue;
					}
				}

				$arrArchives[] = $objArchive->id;
			}
		}

		return $arrArchives;
	}
protected function sortOutProtected ( $ arrArchives ) { if ( empty ( $ arrArchives ) || ! \ is_array ( $ arrArchives ) ) { return $ arrArchives ; } $ this -> import ( FrontendUser :: class , 'User' ) ; $ objArchive = NewsArchiveModel :: findMultipleByIds ( $ arrArchives ) ; $ arrArchives = array ( ) ; if ( $ objArchive !== null ) { while ( $ objArchive -> next ( ) ) { if ( $ objArchive -> protected ) { if ( ! FE_USER_LOGGED_IN || ! \ is_array ( $ this -> User -> groups ) ) { continue ; } $ groups = StringUtil :: deserialize ( $ objArchive -> groups ) ; if ( empty ( $ groups ) || ! \ is_array ( $ groups ) || ! \ count ( array_intersect ( $ groups , $ this -> User -> groups ) ) ) { continue ; } } $ arrArchives [ ] = $ objArchive -> id ; } } return $ arrArchives ; }
Sort out protected archives

@param array $arrArchives

@return array
Sort out protected archives