• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP node_access_rebuild函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中node_access_rebuild函数的典型用法代码示例。如果您正苦于以下问题:PHP node_access_rebuild函数的具体用法?PHP node_access_rebuild怎么用?PHP node_access_rebuild使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: setUp

 function setUp()
 {
     parent::setUp();
     node_access_rebuild();
     node_access_test_add_field(entity_load('node_type', 'forum'));
     \Drupal::state()->set('node_access_test.private', TRUE);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:7,代码来源:ForumNodeAccessTest.php


示例2: setUp

 /**
  * Preparation work that is done before each test.
  * Test users, content types, nodes etc. are created.
  */
 function setUp($module = '')
 {
     if (empty($module)) {
         // Enable content access module
         parent::setUp('content_access');
     } else {
         // Enable content access module plus another module
         parent::setUp('content_access', $module);
         // Stop setup when module could not be enabled
         if (!module_exists($module)) {
             $this->pass('No ' . $module . ' module present, skipping test');
             return;
         }
     }
     // Create test user with seperate role
     $this->test_user = $this->backdropCreateUser();
     // Get the value of the new role
     // Needed in D7 because it's by default create two roles for new users
     // one role is Authenticated and the second is new default one
     // @see backdropCreateUser()
     foreach ($this->test_user->roles as $rid => $role) {
         if (!in_array($rid, array(BACKDROP_AUTHENTICATED_RID))) {
             $this->rid = $rid;
             break;
         }
     }
     // Create admin user
     $this->admin_user = $this->backdropCreateUser(array('access content', 'administer content types', 'grant content access', 'grant own content access', 'administer nodes', 'access administration pages'));
     $this->backdropLogin($this->admin_user);
     // Rebuild content access permissions
     node_access_rebuild();
     // Create test content type
     $this->content_type = $this->backdropCreateContentType();
 }
开发者ID:docwilmot,项目名称:content_access,代码行数:38,代码来源:content_access_test_help.php


示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     node_access_test_add_field(NodeType::load('article'));
     node_access_rebuild();
     \Drupal::state()->set('node_access_test.private', TRUE);
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:7,代码来源:NodeAccessBaseTableTest.php


示例4: setUp

 public function setUp()
 {
     parent::setUp();
     node_access_rebuild();
     $this->drupalCreateContentType(array('type' => 'page', 'name' => t('Basic page')));
     $this->container->get('comment.manager')->addDefaultField('node', 'page');
     $this->web_user = $this->drupalCreateUser(array('access content', 'access comments', 'node test view'));
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:8,代码来源:NodeAccessPagerTest.php


示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     node_access_rebuild();
     // Create a test user and log in.
     $this->testUser = $this->drupalCreateUser(array('access content', 'search content', 'use advanced search', 'access user profiles'));
     $this->drupalLogin($this->testUser);
 }
开发者ID:318io,项目名称:318-io,代码行数:8,代码来源:SearchNodeDiacriticsTest.php


示例6: setUp

 protected function setUp()
 {
     parent::setUp();
     node_access_rebuild();
     $this->drupalCreateContentType(array('type' => 'page', 'name' => t('Basic page')));
     $this->addDefaultCommentField('node', 'page');
     $this->webUser = $this->drupalCreateUser(array('access content', 'access comments', 'node test view'));
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:8,代码来源:NodeAccessPagerTest.php


示例7: setUp

 public function setUp()
 {
     parent::setUp();
     node_access_rebuild();
     $this->drupalCreateContentType(array('type' => 'page'));
     node_access_test_add_field(entity_load('node_type', 'page'));
     $this->container->get('comment.manager')->addDefaultField('node', 'page', 'comment', CommentItemInterface::OPEN);
     \Drupal::state()->set('node_access_test.private', TRUE);
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:9,代码来源:TrackerNodeAccessTest.php


示例8: setUp

 protected function setUp()
 {
     parent::setUp();
     node_access_rebuild();
     // Re-create user.
     $this->webUser = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content', 'edit own comments', 'node test view', 'skip comment approval'));
     // Set the author of the created node to the web_user uid.
     $this->node->setOwnerId($this->webUser->id())->save();
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:9,代码来源:CommentNodeAccessTest.php


示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     node_access_rebuild();
     $this->drupalCreateContentType(array('type' => 'page'));
     node_access_test_add_field(NodeType::load('page'));
     $this->addDefaultCommentField('node', 'page', 'comment', CommentItemInterface::OPEN);
     \Drupal::state()->set('node_access_test.private', TRUE);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:9,代码来源:TrackerNodeAccessTest.php


示例10: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     node_access_rebuild();
     // Create some content.
     $this->drupalCreateNode();
     $this->drupalCreateNode();
     $this->drupalCreateNode();
     $this->drupalCreateNode();
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:13,代码来源:NodeAccessAutoBubblingTest.php


示例11: setUp

 function setUp()
 {
     parent::setUp();
     // node_access_test requires a node_access_rebuild().
     node_access_rebuild();
     // Create users.
     $this->book_author = $this->drupalCreateUser(array('create new books', 'create book content', 'edit own book content', 'add content to books'));
     $this->web_user = $this->drupalCreateUser(array('access printer-friendly version', 'node test view'));
     $this->admin_user = $this->drupalCreateUser(array('create new books', 'create book content', 'edit own book content', 'add content to books', 'administer blocks', 'administer permissions', 'administer book outlines', 'node test view', 'administer content types', 'administer site configuration'));
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:10,代码来源:BookTest.php


示例12: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create Article node type.
     $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
     $this->accessHandler = \Drupal::entityManager()->getAccessControlHandler('node');
     node_access_test_add_field(NodeType::load('article'));
     // After enabling a node access module, the access table has to be rebuild.
     node_access_rebuild();
     // Enable the private node feature of the node_access_test module.
     \Drupal::state()->set('node_access_test.private', TRUE);
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:15,代码来源:BulkFormAccessTest.php


示例13: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->drupalPlaceBlock('system_breadcrumb_block');
     // node_access_test requires a node_access_rebuild().
     node_access_rebuild();
     // Create users.
     $this->bookAuthor = $this->drupalCreateUser(array('create new books', 'create book content', 'edit own book content', 'add content to books'));
     $this->webUser = $this->drupalCreateUser(array('access printer-friendly version', 'node test view'));
     $this->webUserWithoutNodeAccess = $this->drupalCreateUser(array('access printer-friendly version'));
     $this->adminUser = $this->drupalCreateUser(array('create new books', 'create book content', 'edit own book content', 'add content to books', 'administer blocks', 'administer permissions', 'administer book outlines', 'node test view', 'administer content types', 'administer site configuration'));
 }
开发者ID:ravindrasingh22,项目名称:Drupal-8-rc,代码行数:15,代码来源:BookTest.php


示例14: setUp

 protected function setUp()
 {
     parent::setUp();
     // Create the 'private' field, which allows the node to be marked as private
     // (restricted access) in a given translation.
     $field_storage = FieldStorageConfig::create(array('field_name' => 'field_private', 'entity_type' => 'node', 'type' => 'boolean', 'cardinality' => 1));
     $field_storage->save();
     FieldConfig::create(['field_storage' => $field_storage, 'bundle' => 'page', 'widget' => array('type' => 'options_buttons'), 'settings' => array('on_label' => 'Private', 'off_label' => 'Not private')])->save();
     // After enabling a node access module, the access table has to be rebuild.
     node_access_rebuild();
     // Create a normal authenticated user.
     $this->webUser = $this->drupalCreateUser(array('access content'));
     // Load the user 1 user for later use as an admin user with permission to
     // see everything.
     $this->adminUser = User::load(1);
     // Add Hungarian and Catalan.
     ConfigurableLanguage::createFromLangcode('hu')->save();
     ConfigurableLanguage::createFromLangcode('ca')->save();
     // The node_access_test_language module allows individual translations of a
     // node to be marked private (not viewable by normal users).
     // Create six nodes:
     // 1. Four Hungarian nodes with Catalan translations
     //   - One with neither language marked as private.
     //   - One with only the Hungarian translation private.
     //   - One with only the Catalan translation private.
     //   - One with both the Hungarian and Catalan translations private.
     // 2. Two nodes with no language specified.
     //   - One public.
     //   - One private.
     $this->nodes['both_public'] = $node = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'hu', 'field_private' => array(array('value' => 0))));
     $translation = $node->addTranslation('ca');
     $translation->title->value = $this->randomString();
     $translation->field_private->value = 0;
     $node->save();
     $this->nodes['ca_private'] = $node = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'hu', 'field_private' => array(array('value' => 0))));
     $translation = $node->addTranslation('ca');
     $translation->title->value = $this->randomString();
     $translation->field_private->value = 1;
     $node->save();
     $this->nodes['hu_private'] = $node = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'hu', 'field_private' => array(array('value' => 1))));
     $translation = $node->addTranslation('ca');
     $translation->title->value = $this->randomString();
     $translation->field_private->value = 0;
     $node->save();
     $this->nodes['both_private'] = $node = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'hu', 'field_private' => array(array('value' => 1))));
     $translation = $node->addTranslation('ca');
     $translation->title->value = $this->randomString();
     $translation->field_private->value = 1;
     $node->save();
     $this->nodes['no_language_public'] = $this->drupalCreateNode(array('field_private' => array(array('value' => 0)), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED));
     $this->nodes['no_language_private'] = $this->drupalCreateNode(array('field_private' => array(array('value' => 1)), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED));
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:52,代码来源:NodeAccessLanguageAwareTest.php


示例15: setUp

 protected function setUp()
 {
     parent::setUp();
     node_access_test_add_field(NodeType::load('page'));
     // After enabling a node access module, the access table has to be rebuild.
     node_access_rebuild();
     // Enable the private node feature of the node_access_test module.
     \Drupal::state()->set('node_access_test.private', TRUE);
     // Add Hungarian, Catalan and Croatian.
     ConfigurableLanguage::createFromLangcode('hu')->save();
     ConfigurableLanguage::createFromLangcode('ca')->save();
     ConfigurableLanguage::createFromLangcode('hr')->save();
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:13,代码来源:NodeAccessLanguageTest.php


示例16: setUp

 protected function setUp()
 {
     parent::setUp();
     node_access_rebuild();
     // Create some users.
     $this->adminUser = $this->drupalCreateUser(array('access content', 'bypass node access'));
     $this->contentAdminUser = $this->drupalCreateUser(array('access content', 'administer content types', 'administer node fields'));
     // Add a custom field to the page content type.
     $this->fieldName = Unicode::strtolower($this->randomMachineName() . '_field_name');
     FieldStorageConfig::create(array('field_name' => $this->fieldName, 'entity_type' => 'node', 'type' => 'text'))->save();
     FieldConfig::create(['field_name' => $this->fieldName, 'entity_type' => 'node', 'bundle' => 'page'])->save();
     entity_get_display('node', 'page', 'default')->setComponent($this->fieldName)->save();
     entity_get_form_display('node', 'page', 'default')->setComponent($this->fieldName)->save();
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:14,代码来源:NodeAccessFieldTest.php


示例17: setUp

 public function setUp()
 {
     parent::setUp();
     node_access_rebuild();
     // Create some users.
     $this->admin_user = $this->drupalCreateUser(array('access content', 'bypass node access'));
     $this->content_admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer node fields'));
     // Add a custom field to the page content type.
     $this->field_name = drupal_strtolower($this->randomName() . '_field_name');
     entity_create('field_storage_config', array('name' => $this->field_name, 'entity_type' => 'node', 'type' => 'text'))->save();
     entity_create('field_instance_config', array('field_name' => $this->field_name, 'entity_type' => 'node', 'bundle' => 'page'))->save();
     entity_get_display('node', 'page', 'default')->setComponent($this->field_name)->save();
     entity_get_form_display('node', 'page', 'default')->setComponent($this->field_name)->save();
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:14,代码来源:NodeAccessFieldTest.php


示例18: setUp

 public function setUp()
 {
     parent::setUp();
     // Create the 'private' field, which allows the node to be marked as private
     // (restricted access) in a given translation.
     $field_storage = entity_create('field_storage_config', array('name' => 'field_private', 'entity_type' => 'node', 'type' => 'boolean', 'cardinality' => 1, 'translatable' => TRUE, 'settings' => array('on_label' => 'Private', 'off_label' => 'Not private')));
     $field_storage->save();
     entity_create('field_instance_config', array('field_storage' => $field_storage, 'bundle' => 'page', 'widget' => array('type' => 'options_buttons')))->save();
     // After enabling a node access module, the access table has to be rebuild.
     node_access_rebuild();
     // Create a normal authenticated user.
     $this->web_user = $this->drupalCreateUser(array('access content'));
     // Load the user 1 user for later use as an admin user with permission to
     // see everything.
     $this->admin_user = user_load(1);
     // Add Hungarian and Catalan.
     $language = new Language(array('id' => 'hu'));
     language_save($language);
     $language = new Language(array('id' => 'ca'));
     language_save($language);
     // The node_access_test_language module allows individual translations of a
     // node to be marked private (not viewable by normal users).
     // Create six nodes:
     // 1. Four Hungarian nodes with Catalan translations
     //   - One with neither language marked as private.
     //   - One with only the Hungarian translation private.
     //   - One with only the Catalan translation private.
     //   - One with both the Hungarian and Catalan translations private.
     // 2. Two nodes with no language specified.
     //   - One public.
     //   - One private.
     $this->nodes['both_public'] = $node = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'hu', 'field_private' => array(array('value' => 0))));
     $translation = $node->getTranslation('ca');
     $translation->field_private[0]->value = 0;
     $node->save();
     $this->nodes['ca_private'] = $node = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'hu', 'field_private' => array(array('value' => 0))));
     $translation = $node->getTranslation('ca');
     $translation->field_private[0]->value = 1;
     $node->save();
     $this->nodes['hu_private'] = $node = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'hu', 'field_private' => array(array('value' => 1))));
     $translation = $node->getTranslation('ca');
     $translation->field_private[0]->value = 0;
     $node->save();
     $this->nodes['both_private'] = $node = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'hu', 'field_private' => array(array('value' => 1))));
     $translation = $node->getTranslation('ca');
     $translation->field_private[0]->value = 1;
     $node->save();
     $this->nodes['no_language_public'] = $this->drupalCreateNode(array('field_private' => array(array('value' => 0))));
     $this->nodes['no_language_private'] = $this->drupalCreateNode(array('field_private' => array(array('value' => 1))));
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:50,代码来源:NodeAccessLanguageAwareTest.php


示例19: setUp

 protected function setUp()
 {
     parent::setUp();
     node_access_rebuild();
     // Create some content.
     $this->drupalCreateNode();
     $this->drupalCreateNode();
     $this->drupalCreateNode();
     $this->drupalCreateNode();
     // Create user with simple node access permission. The 'node test view'
     // permission is implemented and granted by the node_access_test module.
     $this->accessUser = $this->drupalCreateUser(array('access content overview', 'access content', 'node test view'));
     $this->noAccessUser = $this->drupalCreateUser(array('access content overview', 'access content'));
     $this->noAccessUser2 = $this->drupalCreateUser(array('access content overview', 'access content'));
 }
开发者ID:systemick3,项目名称:systemick.co.uk,代码行数:15,代码来源:NodeQueryAlterTest.php


示例20: setUp

 function setUp()
 {
     parent::setUp();
     node_access_test_add_field(entity_load('node_type', 'page'));
     // After enabling a node access module, the access table has to be rebuild.
     node_access_rebuild();
     // Enable the private node feature of the node_access_test module.
     \Drupal::state()->set('node_access_test.private', TRUE);
     // Add Hungarian and Catalan.
     $language = new Language(array('id' => 'hu'));
     language_save($language);
     $language = new Language(array('id' => 'ca'));
     language_save($language);
     $language = new Language(array('id' => 'hr'));
     language_save($language);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:16,代码来源:NodeAccessLanguageTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP node_access_test_add_field函数代码示例发布时间:2022-05-15
下一篇:
PHP node_access_grants函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap