public function byID($id)
 {
     $item = parent::byID($id);
     if (!$item) {
         return $item;
     }
     if ($item->hasExtension('Restrictable') && $item->checkPerm($this->requiredPermission)) {
         return $item;
     } elseif ($item->canView()) {
         return $item;
     }
 }
Example #2
0
 /**
  * Determine if the given member belongs to the given relation.
  *
  * @param Member $member
  * @param DataList $relation
  *
  * @return bool
  */
 protected function isMemberOf($member, $relation)
 {
     if (!$member || !$member->exists()) {
         return false;
     }
     if ($relation instanceof UnsavedRelationList) {
         return in_array($member->ID, $relation->getIDList());
     }
     return $relation->byID($member->ID) !== null;
 }
 /**
  * @param int $id the id of an data object
  * @return DataObject the data object with the given id
  */
 public function byID($id)
 {
     return $this->cache($id, function () use($id) {
         return parent::byID($id);
     });
 }