當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。