where("id", "=", $model->id)->find(); // Figure out if the user can access this album. $deny_access = false; $existing_password = ORM::factory("items_albumpassword")->where("album_id", "=", $model->id)->find(); if ($existing_password->loaded()) { if ((cookie::get("g3_albumpassword") != $existing_password->password) && (identity::active_user()->id != $album_item->owner_id)) $deny_access = true; } // set access::DENY if necessary. if ($deny_access == true) { $view_restrictions = array(); if (!identity::active_user()->admin) { foreach (identity::group_ids_for_active_user() as $id) { $view_restrictions[] = array("items.view_$id", "=", access::DENY); } } } if (count($view_restrictions)) { $model->and_open()->merge_or_where($view_restrictions)->close(); } return $model; } }