Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
BasicPersonalisationRule.php
1 <?php
2 /**
3  * Gentics Portal.Node PHP
4  * Author & Copyright (c) by Gentics Software GmbH
5  * sales@gentics.com
6  * http://www.gentics.com
7  * Licenses can be found in the LICENSE.txt file in the root-folder of this installation
8  * You must not use this software without a valid license agreement.
9  *
10  */
12 {
13  /**
14  * get list of personalization attributes for user and content
15  * check if they match
16  *
17  * @param int $userId
18  * @param array $contentPersonalisationAttributes
19  *
20  * @return bool if true they matched. false otherwise
21  */
22  public function checkAccess($userId, $contentPersonalisationAttributes)
23  {
24  if (empty($contentPersonalisationAttributes)) {
25  return true;
26  }
27 
28  $userPersonalisationAttributes = PersonalisationAttribute::flatListForUser($userId);
29  foreach ($contentPersonalisationAttributes as $cpa) {
30  if (in_array($cpa, $userPersonalisationAttributes)) {
31  return true;
32  }
33  }
34 
35  return false;
36  }
37 
38 
39 }