Example #1
0
 function may($u, $lvl)
 {
     global $USER;
     if ($lvl & READ) {
         return $USER->ID != NOBODY;
     } else {
         return parent::may($u, $lvl);
     }
 }
 /**
  * Overrides permission-test. If the user has privilege to EDIT the link, access is granted to the tool to do so.
  */
 function may($u, $a)
 {
     global $Controller, $ID, $CURRENT, $USER;
     if ($a & READ && ($ID == $this->ID && $_REQUEST->numeric('edit') && $Controller->{$_REQUEST['lnedit']}(EDIT) || $ID != $this->ID && get_class($CURRENT) == 'Link' && $CURRENT->may($USER, EDIT))) {
         return true;
     } else {
         return parent::may($u, $a);
     }
 }
Example #3
0
 /**
  * (non-PHPdoc)
  * @see lib/MenuItem#may($u, $lvl)
  */
 function may($u, $lvl)
 {
     if (is_bool($pr = parent::may($u, $lvl))) {
         return $pr;
     } elseif ($lvl & READ) {
         return true;
     } else {
         return $pr;
     }
 }
Example #4
0
 function may($u, $lvl)
 {
     if (is_numeric($u)) {
         $id = $u;
     } elseif (is_string($u)) {
         $u = $Controller->{$u}(OVERRIDE);
     }
     if (is_object($u)) {
         $id = $u->ID;
     }
     if ($id == NOBODY) {
         return false;
     }
     return parent::may($u, $lvl);
 }
Example #5
0
 /**
  * Permission-test overload to allow display if there are any files or folders that allow so
  * @see solidbase/lib/Base#may()
  */
 function may($beneficiary, $accessLevel)
 {
     $p = parent::may($beneficiary, $accessLevel);
     if (is_bool($p)) {
         return $p;
     }
     if ($accessLevel & READ) {
         if (!isset($this->READ[$beneficiary->ID])) {
             global $DB;
             $privilegeIDS = array_merge((array) $beneficiary->ID, $beneficiary->groupIds);
             $this->READ[$beneficiary->ID] = $DB->exists("SELECT `spine`.`id` as id FROM `spine` RIGHT JOIN `privileges` ON `spine`.`id` = `privileges`.`id` WHERE `spine`.`class` IN ('File','Folder') AND `privileges`.`beneficiary` IN ('" . join("','", Database::escape($privilegeIDS, true)) . "') AND (`privileges`.`privileges` & " . READ . ") > 0");
         }
         return $this->READ[$beneficiary->ID] ? true : 0;
     }
     return 0;
 }
Example #6
0
 /**
  *
  */
 function may($u, $lvl)
 {
     if (is_bool($pr = parent::may($u, $lvl))) {
         return $pr;
     } else {
         global $Controller;
         $c = $this->calendars;
         foreach ($c as $cal) {
             if ($Controller->get($cal, $lvl)) {
                 return true;
             }
         }
         if ($lvl & READ) {
             return $this->isActive();
         } else {
             return $pr;
         }
     }
 }
Example #7
0
 function may($u, $lvl)
 {
     if (is_bool($pr = parent::may($u, $lvl))) {
         return $pr;
     } else {
         global $Controller;
         if ($lvl & READ) {
             if ($r = $this->isActive()) {
                 return $r;
             }
             $a = $this->getAuthor(true);
             if (is_string($u) && !is_numeric($u)) {
                 $u = $Controller->{(string) $u}(OVERRIDE);
             }
             if (is_object($u)) {
                 $u = $u->ID;
             }
             return $a == $u;
         } else {
             $a = $this->getAuthor(true);
             if (is_string($u) && !is_numeric($u)) {
                 $u = $Controller->{(string) $u}(OVERRIDE);
             }
             if (is_object($u)) {
                 $u = $u->ID;
             }
             if ($a == $u && $Controller->newsAdmin(READ)) {
                 return true;
             } else {
                 return $Controller->newsAdmin(OVERRIDE)->may($u, $lvl);
             }
         }
     }
 }