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


PHP node_access_rebuild函数代码示例

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


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


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