Gets a comma separated list of frontend user groups to use for the
document ID.

@param Rootline $pageAccessRootline
@return string A comma separated list of frontend user groups.
979537
protected function getDocumentIdGroups(Rootline $pageAccessRootline)
    {
        $groups = $pageAccessRootline->getGroups();
        $groups = Rootline::cleanGroupArray($groups);

        if (empty($groups)) {
            $groups[] = 0;
        }

        $groups = implode(',', $groups);

        return $groups;
    }
815816
public function getUsers($descendants = false) {
    if ($descendants) {
      $groups = $this->getDescendants();
      $or = ['|',
          'ref' => [
            ['group', $groups],
            ['groups', $groups]
          ]
        ];
    } else {
      $or = null;
    }
    $groups[] = $this;
    $return = Nymph::getEntities(
        ['class' => '\Tilmeld\Entities\User'],
        ['&',
          'equal' => ['enabled', true]
        ],
        $or
    );
    return $return;
  }
513671
public function transformAccessLevels($accessLevels, User $user, Group $editedGroup = null)
    {
        $selectorItems = array();
        
        foreach ($accessLevels as $accessLevel) {
            $disabled = false;
            if (!$user->hasAccess($accessLevel->getKey()) || ($editedGroup !== null && $this->isEditedGroup($accessLevel->getKey(), $editedGroup))) {
                $disabled = true;
            }
            
            $name = $accessLevel->getName();
            $description = $accessLevel->getDescription();
            
            if ($accessLevel instanceof GroupAccessLevel) {
                $icon = 'mdi mdi-group';
            } else {
                $icon = 'mdi mdi-toll';

                $name = $this->translationManager->translate($name, $accessLevel->getNamespace());
                $description = $this->translationManager->translate($description, $accessLevel->getNamespace());
            }

            $selectorItems[] = new SelectorItem(
                $accessLevel->getKey(),
                $name,
                $description,
                $icon,
                $disabled
            );
        }
        
        return $selectorItems;
    }
1093133
public function getByRolesIncludingGroups(array $roles, $page = 1, $max = 20, $orderedBy = 'id', $order= null)
    {
        $res = $this->userRepo->findByRolesIncludingGroups($roles, true, $orderedBy, $order);

        return $this->pagerFactory->createPager($res, $page, $max);
    }
562538
public function getSitesGroups()
    {
        Piwik::checkUserHasSuperUserAccess();

        $groups = $this->getModel()->getSitesGroups();
        $cleanedGroups = array_map('trim', $groups);

        return $cleanedGroups;
    }
1010114
public function useUserAccessGroups(array $groups): QueryBuilder
    {
        $groups = array_map('intval', $groups);
        $groups[] = 0; // always grant access to public documents
        $groups = array_unique($groups);
        sort($groups, SORT_NUMERIC);

        $accessFilter = '{!typo3access}' . implode(',', $groups);
        $this->queryToBuild->removeFilterQuery('access');
        return $this->useFilter($accessFilter, 'access');
    }
99443
protected function getRootRouteNode($webspaceKey, $locale, $segment)
    {
        return $this->documentManager->find(
            $this->sessionManager->getRoutePath($webspaceKey, $locale, $segment)
        );
    }
1302091
protected function getRecordPageId($status, $recordTable, $recordUid, $originalUid, array $fields, DataHandler $tceMain)
    {
        if ($recordTable === 'pages' && isset($fields['l10n_parent']) && intval($fields['l10n_parent']) > 0) {
            return $fields['l10n_parent'];
        }

        if ($status === 'update' && !isset($fields['pid'])) {
            $recordPageId = $this->getValidatedPid($tceMain, $recordTable, $recordUid);
            if (($recordTable === 'pages') && ($this->rootPageResolver->getIsRootPageId($recordUid))) {
                $recordPageId = $originalUid;
            }

            return $recordPageId;
        }

        return $fields['pid'];
    }
693609
private function findMostRelevantGroupId()
    {
        if ($this->siteManager->hasDependentContext('group')) {

            /** @var \MakinaCorpus\Ucms\Site\Group $group */
            $group = $this->siteManager->getDependentContext('group');

            if ($group) {
                return (int)$group->getId();
            }
        }

        // There is no context, this means we need to check with user current
        // groups instead; and set the first one we find onto the node
        $accessList = $this->groupManager->getUserGroups($this->currentUser);
        if ($accessList) {
            return (int)reset($accessList)->getGroupId();
        }
    }
1057653
private function getPagesDatas($rootPages)
	{
		$idPage = $this->params()->fromQuery('nodeId', -1);

		if ($idPage == MelisCmsRightsService::MELISCMS_PREFIX_PAGES . '_root')
			$idPage = -1;
		else
			$idPage = str_replace(MelisCmsRightsService::MELISCMS_PREFIX_PAGES . '_', '', $idPage);

		$pageMelisKey = 'meliscms_page';
		$melisAppConfig =$this->getServiceLocator()->get('MelisCoreConfig');
		$appsConfig = $melisAppConfig->getItem($pageMelisKey);

		if (!empty($appsConfig['conf']['id']))
			$zoneId = $appsConfig['conf']['id'];
		else
			$zoneId = 'id_meliscms_page';


		// Get the children
		$melisTree = $this->serviceLocator->get('MelisEngineTree');
		if (!empty($rootPages))
		{
			if ($rootPages[0] == -1 || $idPage != -1)
			{
				$children = $melisTree->getPageChildren($idPage);
				$children = $children->toArray();
			}
			else
			{
				$children = array();
				$tablePageTree = $this->getServiceLocator()->get('MelisEngineTablePageTree');
				foreach ($rootPages as $idPage)
				{
					$pageDetails = $tablePageTree->getFullDatasPage($idPage, '');
					$pageDetails = $pageDetails->toArray();
					$children = array_merge($children, $pageDetails);
				}
			}
		}
		else
		{
			return array();
		}


		// Making a new array with one unique page from published or save
		$final = array();
		foreach($children as $page)
		{
			$data_page_id = $page['tree_page_id'];

			/**
			 * Check which table must be used depending on if there's data
			 * in saved or published table.
			 * Saved results come withe same column name prefixed by s_
			 */
			if (!empty($page['s_page_id']))
			{
				$has_saved_version = 1;
				$prefixTable = 's_';
			}
			else
			{
				$has_saved_version = 0;
				$prefixTable = '';
			}

			// Prefix the id with the pageId
			$zoneIdTmp = $data_page_id . '_' . $zoneId;

			// Check if node has children
			$has_children = false;
			$childrenTmp = $melisTree->getPageChildren($data_page_id);
			if ($childrenTmp)
			{
				$childrenTmp = $childrenTmp->toArray();
				if (count($childrenTmp) > 0)
					$has_children = true;
			}

			// Check if the publish page is online to know for our result
			$is_online = 0;
			if (!empty($page['page_status']) && $page['page_status'] == 1)
				$is_online = 1;

			// Type of page is in table defined previously
			$data_page_type = $page[$prefixTable . 'page_type'];

			// We show always published name in tree, saved if no published
			if (!empty($page['page_name']))
				$data_page_name = $page['page_name'];
			else
			{
				if (!empty($page['s_page_name']))
					$data_page_name = $page['s_page_name'];
				else
					$data_page_name = $page['page_name'];
			}

			switch ($data_page_type) {
				case 'PAGE': 
					$data_icon = 'fa fa-file-o';
					break;
				case 'SITE': 
					$data_icon = 'fa fa-home';
					break;
				case 'FOLDER': 
					$data_icon = 'fa fa-folder-open-o';
					break;
				case 'NEWSLETTER': 
					$data_icon = 'fa fa-newspaper-o';
					break;
				default: 
					$data_icon = '';
					break;
			}

			$newpage = array(
				// These datas are common to all treeviews
				'item_zoneid' => $zoneIdTmp,
				'item_melisKey' => $pageMelisKey,
				'item_name' => $data_page_id . ' - ' . $data_page_name,
				'item_is_on' => $is_online,
				'item_has_version' => $has_saved_version,
				'item_icon' => $data_icon,
				'item_has_children' => $has_children,
				'item_dragdrop' => $this->isAllowedDragDrop(),

				// These datas are added and will be sent back when calling the view from the melisKey
				'item_datas' => array(
					'page_title' => $data_page_name,
					'page_id' => $data_page_id,
					'page_has_saved_version' => $has_saved_version,
					'page_is_online' => $is_online,
					'page_type' => $data_page_type,
					'item_zoneid' => $zoneIdTmp,
					'item_melisKey' => $pageMelisKey,
				)
			);

			array_push($final, $newpage);
		}

		return $final;
	}
1337159
public function getPageTypes($dc)
    {
        $options = [];
        $rootAllowed = true;

        if ($dc->activeRecord->pid > 0) {
            $rootAllowed = false;
            $parentType = $this->db->fetchColumn('SELECT type FROM tl_page WHERE id=?', [$dc->activeRecord->pid]);

            // Allow root in second level if the parent is folder
            if ($parentType === 'folder') {
                $rootAllowed = true;
            }
        }

        foreach (array_keys($GLOBALS['TL_PTY']) as $pty) {
            // Root pages are allowed on the first level only (see #6360)
            if ($pty === 'root' && !$rootAllowed) {
                continue;
            }

            // Allow the currently selected option and anything the user has access to
            if ($pty === $dc->value || $this->user->hasAccess($pty, 'alpty')) {
                $options[] = $pty;
            }
        }

        return $options;
    }
410702
public function findMountPointPropertiesByPageIdOrByRootLineParentPageIds(int $mountedPageUid, array $rootLineParentPageIds = []) : array
    {
        if (array_filter($rootLineParentPageIds, 'is_int') !== $rootLineParentPageIds) {
            throw new \InvalidArgumentException('Given $rootLineParentPageIds array is not valid. Allowed only the arrays with the root line page UIDs as integers.', 1502459711);
        }

        $queryBuilder = $this->getQueryBuilder();
        $queryBuilder->select('uid', 'uid AS mountPageDestination', 'mount_pid AS mountPageSource', 'mount_pid_ol AS mountPageOverlayed')->from($this->table);
        $queryBuilder = $this->addWhereClauseForMountpointDestinationProperties($queryBuilder, $mountedPageUid, $rootLineParentPageIds);
        $result = $queryBuilder->execute()->fetchAll();
        return $result;
    }
63862
static function FindPageGroup(Page $page)
    {
        $currPage = $page;
        $result = null;
        do 
        {
            $result = $currPage->GetUserGroup();
            $currPage = $currPage->GetParent();
        } 
        while (!$result && $currPage);
        if (!$result && $page->GetSite())
        {
            return $page->GetSite()->GetUserGroup();
        }
        return $result;
    }
1074458
public function getLocalizedUrlsForPage(BasePageDocument $page)
    {
        $localizedUrls = [];
        $webspaceKey = $this->getWebspace($page);
        $webspace = $this->webspaceManager->findWebspaceByKey($webspaceKey);
        $node = $this->getNode($page);

        $structure = $this->getStructureMetadata($page);
        $resourceLocatorProperty = $structure->getPropertyByTagName('sulu.rlp');

        foreach ($webspace->getAllLocalizations() as $localization) {
            $resolvedLocale = $localization->getLocale();
            $locale = $resolvedLocale;

            $shadowEnabledName = $this->encoder->localizedSystemName(
                ShadowLocaleSubscriber::SHADOW_ENABLED_FIELD,
                $resolvedLocale
            );

            if (true === $node->getPropertyValueWithDefault($shadowEnabledName, false)) {
                $shadowLocaleName = $this->encoder->localizedSystemName(
                    ShadowLocaleSubscriber::SHADOW_LOCALE_FIELD,
                    $resolvedLocale
                );
                $resolvedLocale = $node->getPropertyValue($shadowLocaleName);
            }

            $stageName = $this->encoder->localizedSystemName(
                WorkflowStageSubscriber::WORKFLOW_STAGE_FIELD,
                $resolvedLocale
            );

            if (false === $node->hasProperty($stageName)) {
                continue;
            }

            $stage = $node->getProperty($stageName);

            if (WorkflowStage::PUBLISHED !== $stage->getValue()) {
                continue;
            }

            $url = $node->getPropertyValueWithDefault(
                $this->encoder->localizedContentName($resourceLocatorProperty->getName(), $locale),
                null
            );

            if (null === $url) {
                continue;
            }

            $localizedUrls[$locale] = $url;
        }

        return $localizedUrls;
    }
889277
public function getAccessPolicyList()
    {
        $propertyList = $this->_getEntityList('AccessPolicies');
        $result = [];

        foreach ($propertyList as $properties) {
            $result[] = AccessPolicy::createFromOptions($properties);
        }

        return $result;
    }
78578
public function getRootPage($pageUid)
    {
        $info = $this->getPageInfo($pageUid);

        while ($info && $info['pid'] && !$info['is_siteroot']) {
            $info = $this->getPageInfo((int) $info['pid']);
        }

        return (int) $info['uid'];
    }
358117
public function getTreePagesForRightsManagementAction()
	{
		$idPage = $this->params()->fromQuery('nodeId', -1);

		if ($idPage == MelisCmsRightsService::MELISCMS_PREFIX_PAGES . '_root')
			$idPage = -1;
		else
			$idPage = str_replace(MelisCmsRightsService::MELISCMS_PREFIX_PAGES . '_', '', $idPage);

		$rootPages = array($idPage);
		$final = $this->getPagesDatas($rootPages);

		return $this->formatTreeResponse($final, true);
	}