Example #1
0
 /**
  * checks access to the album
  * @param bit $action What the requestor wants to do
  *
  * returns true of access is allowed
  */
 function isMyItem($action)
 {
     global $_zp_loggedin;
     if ($parent = parent::isMyItem($action)) {
         return $parent;
     }
     if (zp_loggedin($action)) {
         $subRights = $this->albumSubRights();
         if (!is_null($subRights)) {
             $albumrights = LIST_RIGHTS;
             if ($subRights & MANAGED_OBJECT_RIGHTS_EDIT) {
                 $albumrights = $albumrights | ALBUM_RIGHTS;
             }
             if ($subRights & MANAGED_OBJECT_RIGHTS_UPLOAD) {
                 $albumrights = $albumrights | UPLOAD_RIGHTS;
             }
             if ($action & $albumrights) {
                 return $_zp_loggedin ^ (ALBUM_RIGHTS | UPLOAD_RIGHTS) | $albumrights;
             } else {
                 return false;
             }
         }
     }
     return false;
 }
Example #2
0
 /**
  * checks access to the album
  * @param bit $action What the requestor wants to do
  *
  * returns true of access is allowed
  */
 function isMyItem($action)
 {
     global $_zp_loggedin;
     if ($parent = parent::isMyItem($action)) {
         return $parent;
     }
     if (zp_loggedin($action)) {
         $subRights = $this->albumSubRights();
         if (is_null($subRights)) {
             // no direct rights, but if this is a private gallery and the album is published he should be allowed to see it
             if (GALLERY_SECURITY != 'public' && $this->getShow() && $action == LIST_RIGHTS) {
                 return LIST_RIGHTS;
             }
         } else {
             $albumrights = LIST_RIGHTS;
             if ($subRights & MANAGED_OBJECT_RIGHTS_EDIT) {
                 $albumrights = $albumrights | ALBUM_RIGHTS;
             }
             if ($subRights & MANAGED_OBJECT_RIGHTS_UPLOAD) {
                 $albumrights = $albumrights | UPLOAD_RIGHTS;
             }
             if ($action & $albumrights) {
                 return $_zp_loggedin ^ (ALBUM_RIGHTS | UPLOAD_RIGHTS) | $albumrights;
             } else {
                 return false;
             }
         }
     }
     return false;
 }
Example #3
0
 /**
  * checks access to the album
  * @param bit $action What the requestor wants to do
  *
  * returns true of access is allowed
  */
 function isMyItem($action)
 {
     global $_zp_current_admin_obj;
     if ($parent = parent::isMyItem($action)) {
         return $parent;
     }
     if ($_zp_current_admin_obj && $_zp_current_admin_obj->getUser() == $this->getOwner()) {
         return true;
     }
     if (zp_loggedin($action)) {
         $subRights = $this->subRights();
         if ($subRights) {
             $rights = LIST_RIGHTS;
             if ($subRights & MANAGED_OBJECT_RIGHTS_EDIT) {
                 $rights = $rights | ALBUM_RIGHTS;
             }
             if ($subRights & MANAGED_OBJECT_RIGHTS_UPLOAD) {
                 $rights = $rights | UPLOAD_RIGHTS;
             }
             if ($action & $rights) {
                 return true;
             } else {
                 return false;
             }
         }
     }
     return false;
 }