当前位置: 首页>>代码示例>>PHP>>正文


PHP identity::everybody方法代码示例

本文整理汇总了PHP中identity::everybody方法的典型用法代码示例。如果您正苦于以下问题:PHP identity::everybody方法的具体用法?PHP identity::everybody怎么用?PHP identity::everybody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在identity的用法示例。


在下文中一共展示了identity::everybody方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: post_test

 public function post_test()
 {
     access::allow(identity::everybody(), "edit", item::root());
     $request = new stdClass();
     $request->params = new stdClass();
     $request->params->name = "test tag";
     $this->assert_equal(array("url" => url::site("rest/tag/1")), tags_rest::post($request));
 }
开发者ID:andyst,项目名称:gallery3,代码行数:8,代码来源:Tags_Rest_Helper_Test.php

示例2: post_test

 public function post_test()
 {
     $tag = test::random_tag();
     // Create an editable item to be tagged
     $album = test::random_album();
     access::allow(identity::everybody(), "edit", $album);
     // Add the album to the tag
     $request->url = rest::url("tag", $tag);
     $request->params->url = rest::url("item", $album);
     $this->assert_equal_array(array("url" => rest::url("tag_item", $tag, $album)), tag_rest::post($request));
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:11,代码来源:Tag_Rest_Helper_Test.php

示例3: _get_proxy

 private function _get_proxy()
 {
     $album = test::random_album();
     $photo = test::random_photo($album);
     access::deny(identity::everybody(), "view_full", $album);
     access::deny(identity::registered_users(), "view_full", $album);
     $proxy = ORM::factory("digibug_proxy");
     $proxy->uuid = random::hash();
     $proxy->item_id = $photo->id;
     return $proxy->save();
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:11,代码来源:Digibug_Controller_Test.php

示例4: viewable_test

 public function viewable_test()
 {
     $root = ORM::factory("item", 1);
     $album = album::create($root, rand(), rand(), rand());
     $item = self::_create_random_item($album);
     identity::set_active_user(identity::guest());
     // We can see the item when permissions are granted
     access::allow(identity::everybody(), "view", $album);
     $this->assert_equal(1, ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
     // We can't see the item when permissions are denied
     access::deny(identity::everybody(), "view", $album);
     $this->assert_equal(0, ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
 }
开发者ID:viosca,项目名称:gallery3,代码行数:13,代码来源:Item_Helper_Test.php

示例5: viewable_test

 public function viewable_test()
 {
     $album = test::random_album();
     $item = test::random_photo($album);
     $album->reload();
     identity::set_active_user(identity::guest());
     // We can see the item when permissions are granted
     access::allow(identity::everybody(), "view", $album);
     $this->assert_equal(1, ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
     // We can't see the item when permissions are denied
     access::deny(identity::everybody(), "view", $album);
     $this->assert_equal(0, ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
 }
开发者ID:assad2012,项目名称:gallery3-appfog,代码行数:13,代码来源:Item_Helper_Test.php

示例6: cant_view_comments_for_unviewable_items_test

 public function cant_view_comments_for_unviewable_items_test()
 {
     $root = ORM::factory("item", 1);
     $album = album::create($root, rand(), rand(), rand());
     $comment = comment::create($album, identity::guest(), "text", "name", "email", "url");
     identity::set_active_user(identity::guest());
     // We can see the comment when permissions are granted on the album
     access::allow(identity::everybody(), "view", $album);
     $this->assert_equal(1, ORM::factory("comment")->viewable()->where("comments.id", "=", $comment->id)->count_all());
     // We can't see the comment when permissions are denied on the album
     access::deny(identity::everybody(), "view", $album);
     $this->assert_equal(0, ORM::factory("comment")->viewable()->where("comments.id", "=", $comment->id)->count_all());
 }
开发者ID:viosca,项目名称:gallery3,代码行数:13,代码来源:Comment_Model_Test.php

示例7: post_fails_without_permissions_test

 public function post_fails_without_permissions_test()
 {
     access::deny(identity::everybody(), "edit", item::root());
     identity::set_active_user(identity::guest());
     try {
         $request->params->name = "test tag";
         tags_rest::post($request);
     } catch (Exception $e) {
         $this->assert_equal(403, $e->getCode());
         return;
     }
     $this->assert_true(false, "Shouldnt get here");
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:13,代码来源:Tags_Rest_Helper_Test.php

示例8: setup

 public function setup()
 {
     $this->_server = $_SERVER;
     $root = ORM::factory("item", 1);
     $this->_album = album::create($root, rand(), "test album");
     access::deny(identity::everybody(), "view_full", $this->_album);
     access::deny(identity::registered_users(), "view_full", $this->_album);
     $rand = rand();
     $this->_item = photo::create($this->_album, MODPATH . "gallery/tests/test.jpg", "{$rand}.jpg", $rand, $rand);
     $this->_proxy = ORM::factory("digibug_proxy");
     $this->_proxy->uuid = md5(rand());
     $this->_proxy->item_id = $this->_item->id;
     $this->_proxy->save();
 }
开发者ID:viosca,项目名称:gallery3,代码行数:14,代码来源:Digibug_Controller_Test.php

示例9: change_album_no_csrf_fails_test

 public function change_album_no_csrf_fails_test()
 {
     $controller = new Albums_Controller();
     $album = test::random_album();
     $_POST["name"] = "new name";
     $_POST["title"] = "new title";
     $_POST["description"] = "new description";
     access::allow(identity::everybody(), "edit", item::root());
     try {
         $controller->update($album->id);
         $this->assert_true(false, "This should fail");
     } catch (Exception $e) {
         // pass
         $this->assert_same("@todo FORBIDDEN", $e->getMessage());
     }
 }
开发者ID:assad2012,项目名称:gallery3-appfog,代码行数:16,代码来源:Albums_Controller_Test.php

示例10: change_album_no_csrf_fails_test

 public function change_album_no_csrf_fails_test()
 {
     $controller = new Albums_Controller();
     $root = ORM::factory("item", 1);
     $this->_album = album::create($root, "test", "test", "test");
     $_POST["name"] = "new name";
     $_POST["title"] = "new title";
     $_POST["description"] = "new description";
     access::allow(identity::everybody(), "edit", $root);
     try {
         $controller->_update($this->_album);
         $this->assert_true(false, "This should fail");
     } catch (Exception $e) {
         // pass
     }
 }
开发者ID:viosca,项目名称:gallery3,代码行数:16,代码来源:Albums_Controller_Test.php

示例11: cant_view_comments_for_unviewable_items_test

 public function cant_view_comments_for_unviewable_items_test()
 {
     $album = test::random_album();
     $comment = ORM::factory("comment");
     $comment->item_id = $album->id;
     $comment->author_id = identity::admin_user()->id;
     $comment->text = "text";
     $comment->save();
     identity::set_active_user(identity::guest());
     // We can see the comment when permissions are granted on the album
     access::allow(identity::everybody(), "view", $album);
     $this->assert_true(ORM::factory("comment")->viewable()->where("comments.id", "=", $comment->id)->count_all());
     // We can't see the comment when permissions are denied on the album
     access::deny(identity::everybody(), "view", $album);
     $this->assert_false(ORM::factory("comment")->viewable()->where("comments.id", "=", $comment->id)->count_all());
 }
开发者ID:kandsten,项目名称:gallery3,代码行数:16,代码来源:Comment_Model_Test.php

示例12: change_photo_no_csrf_fails_test

 public function change_photo_no_csrf_fails_test()
 {
     $controller = new Photos_Controller();
     $root = ORM::factory("item", 1);
     $photo = photo::create($root, MODPATH . "gallery/tests/test.jpg", "test.jpg", "test", "test");
     $_POST["name"] = "new name";
     $_POST["title"] = "new title";
     $_POST["description"] = "new description";
     access::allow(identity::everybody(), "edit", $root);
     try {
         $controller->_update($photo);
         $this->assert_true(false, "This should fail");
     } catch (Exception $e) {
         // pass
     }
 }
开发者ID:ChrisRut,项目名称:gallery3,代码行数:16,代码来源:Photos_Controller_Test.php

示例13: illegal_access_test

 public function illegal_access_test()
 {
     $album = test::random_album();
     $photo = test::random_photo($album);
     $album->reload();
     access::deny(identity::everybody(), "view", $album);
     identity::set_active_user(identity::guest());
     $request = new stdClass();
     $request->url = rest::url("data", $photo, "thumb");
     $request->params = new stdClass();
     $request->params->size = "thumb";
     try {
         data_rest::get($request);
         $this->assert_true(false);
     } catch (Kohana_404_Exception $e) {
         // pass
     }
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:18,代码来源:Data_Rest_Helper_Test.php

示例14: print_photo

 public function print_photo($id)
 {
     access::verify_csrf();
     $item = ORM::factory("item", $id);
     access::required("view", $item);
     if (access::group_can(identity::everybody(), "view_full", $item)) {
         $full_url = $item->file_url(true);
         $thumb_url = $item->thumb_url(true);
     } else {
         $proxy = ORM::factory("digibug_proxy");
         $proxy->uuid = random::hash();
         $proxy->item_id = $item->id;
         $proxy->save();
         $full_url = url::abs_site("digibug/print_proxy/full/{$proxy->uuid}/{$item->id}");
         $thumb_url = url::abs_site("digibug/print_proxy/thumb/{$proxy->uuid}/{$item->id}");
     }
     $v = new View("digibug_form.html");
     $v->order_params = array("digibug_api_version" => "100", "company_id" => module::get_var("digibug", "company_id"), "event_id" => module::get_var("digibug", "event_id"), "cmd" => "addimg", "partner_code" => "69", "return_url" => url::abs_site("digibug/close_window"), "num_images" => "1", "image_1" => $full_url, "thumb_1" => $thumb_url, "image_height_1" => $item->height, "image_width_1" => $item->width, "thumb_height_1" => $item->thumb_height, "thumb_width_1" => $item->thumb_width, "title_1" => html::purify($item->title));
     print $v;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:20,代码来源:digibug.php

示例15: _get_admin_view

 private function _get_admin_view($form, $errors)
 {
     $v = new Admin_View("admin.html");
     $v->page_title = t("User registration");
     $v->content = new View("admin_register.html");
     $v->content->action = "admin/register/update";
     $v->content->policy_list = array("admin_only" => t("Only site administrators can create new user accounts."), "visitor" => t("Visitors can create accounts and no administrator approval is required."), "admin_approval" => t("Visitors can create accounts but administrator approval is required."));
     $admin = identity::admin_user();
     $v->content->disable_email = empty($admin->email) || $form["policy"] == "admin_only" ? "disabled" : "";
     if (empty($admin->email)) {
         module::set_var("registration", "email_verification", false);
     }
     // below lines added Shad Laws, v2
     $v->content->disable_admin_notify = empty($admin->email) || $form["policy"] !== "admin_approval" ? "disabled" : "";
     if (empty($admin->email)) {
         module::set_var("registration", "admin_notify", false);
     }
     $v->content->group_list = array();
     foreach (identity::groups() as $group) {
         if ($group->id != identity::everybody()->id && $group->id != identity::registered_users()->id) {
             $v->content->group_list[$group->id] = $group->name;
         }
     }
     $hidden = array("name" => "csrf", "value" => access::csrf_token());
     if (count($v->content->group_list)) {
         $v->content->group_list = array("" => t("Choose the default group")) + $v->content->group_list;
     } else {
         $hidden["group"] = "";
     }
     $v->content->hidden = $hidden;
     $v->content->pending = ORM::factory("pending_user")->find_all();
     $v->content->activate = "admin/register/activate";
     $v->content->form = $form;
     $v->content->errors = $errors;
     return $v;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:36,代码来源:admin_register.php


注:本文中的identity::everybody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。