Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
VerifyAttributeAccess.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5  */
6 
7 
8 namespace Dcp;
9 
11 {
12 
13  protected static $attributeGrants = array();
14  /**
15  * Verify is attribute has visible access
16  * @param \Doc $doc the document to see
17  * @param \BasicAttribute $attribute the attribut to see
18  * @return bool return true if can be viewed
19  */
21  {
22 
23  $key = sprintf("%0d-%0d-%0d-%s", $doc->fromid, $doc->cvid, $doc->wid, $doc->state);
24 
25  if (!isset(self::$attributeGrants[$key])) {
26  if (!$doc->mid) {
28  }
29  self::$attributeGrants[$key] = array();
30  $oas = $doc->getNormalAttributes();
31  foreach ($oas as $oa) {
32  if ($oa->mvisibility === "I") {
33  self::$attributeGrants[$key][$oa->id] = false;
34  }
35  }
36  }
37  return (!isset(self::$attributeGrants[$key][$attribute->id]));
38  }
39  public static function clearCache()
40  {
41  self::$attributeGrants = array();
42  }
43 }
getNormalAttributes($onlyopt=false)
Definition: Class.Doc.php:2387
setMask($mid)
Definition: Class.Doc.php:2235
$attribute
static isAttributeAccessGranted(\Doc $doc,\BasicAttribute $attribute)
const USEMASKCVVIEW
Definition: Class.Doc.php:60
← centre documentaire © anakeen