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


PHP Permission::flush_permission_cache方法代码示例

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


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

示例1: activateState

 function activateState($state)
 {
     // We always just set the $_GET variable rather than store in Session - this always works, has highest priority
     // in Subsite::currentSubsiteID() and doesn't persist unlike Subsite::changeSubsite
     $_GET['SubsiteID'] = $state;
     Permission::flush_permission_cache();
 }
开发者ID:helpfulrobot,项目名称:silverstripe-fulltextsearch,代码行数:7,代码来源:SearchVariantSubsites.php

示例2: testFrontendBlogPostRequiresPermission

 function testFrontendBlogPostRequiresPermission()
 {
     // get valid SecurityID (from comments form, would usually be copy/pasted)
     $blogEntry = $this->objFromFixture('BlogEntry', 'entry1');
     $response = $this->get($blogEntry->RelativeLink());
     $securityID = Session::get('SecurityID');
     // without login
     $data = array('Title' => 'Disallowed', 'Author' => 'Disallowed', 'BlogPost' => 'Disallowed', 'action_postblog' => 'Post blog entry', 'SecurityID' => $securityID);
     $response = $this->post('blog/BlogEntryForm', $data);
     $this->assertFalse(DataObject::get_one('BlogEntry', sprintf("\"Title\" = 'Disallowed'")));
     // with login
     $blogEditor = $this->objFromFixture('Member', 'blog_editor');
     $this->session()->inst_set('loggedInAs', $blogEditor->ID);
     Permission::flush_permission_cache();
     $data = array('Title' => 'Allowed', 'Author' => 'Allowed', 'BlogPost' => 'Allowed', 'action_postblog' => 'Post blog entry', 'SecurityID' => $securityID);
     $response = $this->post('blog/BlogEntryForm', $data);
     $this->assertType('BlogEntry', DataObject::get_one('BlogEntry', sprintf("\"Title\" = 'Allowed'")));
 }
开发者ID:nicmart,项目名称:comperio-site,代码行数:18,代码来源:BlogHolderFunctionalTest.php

示例3: onBeforeWrite

 public function onBeforeWrite()
 {
     parent::onBeforeWrite();
     // Just in case we've altered someone's permissions
     Permission::flush_permission_cache();
 }
开发者ID:Raiser,项目名称:Praktikum,代码行数:6,代码来源:Permission.php

示例4: onAfterWrite

 public function onAfterWrite()
 {
     parent::onAfterWrite();
     Permission::flush_permission_cache();
     if ($this->isChanged('Password')) {
         MemberPassword::log($this);
     }
 }
开发者ID:guttmann,项目名称:silverstripe-framework,代码行数:8,代码来源:Member.php

示例5: tearDown

 public function tearDown()
 {
     Security::setDefaultAdmin($this->defaultUsername, $this->defaultPassword);
     Permission::flush_permission_cache();
     parent::tearDown();
 }
开发者ID:XDdesigners,项目名称:silverstripe-framework,代码行数:6,代码来源:SecurityDefaultAdminTest.php

示例6: changeSubsite

 /**
  * Switch to another subsite.
  *
  * @param int|Subsite $subsite Either the ID of the subsite, or the subsite object itself
  */
 static function changeSubsite($subsite)
 {
     if (is_object($subsite)) {
         $subsiteID = $subsite->ID;
     } else {
         $subsiteID = $subsite;
     }
     Session::set('SubsiteID', (int) $subsiteID);
     // Set locale
     if (is_object($subsite) && $subsite->Language != '') {
         if (isset(i18n::$likely_subtags[$subsite->Language])) {
             i18n::set_locale(i18n::$likely_subtags[$subsite->Language]);
         }
     }
     // Only bother flushing caches if we've actually changed
     if ($subsiteID != self::currentSubsiteID()) {
         Permission::flush_permission_cache();
     }
 }
开发者ID:hafriedlander,项目名称:silverstripe-config-experiment,代码行数:24,代码来源:Subsite.php

示例7: changeSubsite

 /**
  * Switch to another subsite through storing the subsite identifier in the current PHP session.
  * Only takes effect when {@link Subsite::$use_session_subsiteid} is set to TRUE.
  *
  * @param int|Subsite $subsite Either the ID of the subsite, or the subsite object itself
  */
 public static function changeSubsite($subsite)
 {
     // Session subsite change only meaningful if the session is active.
     // Otherwise we risk setting it to wrong value, e.g. if we rely on currentSubsiteID.
     if (!Subsite::$use_session_subsiteid) {
         return;
     }
     if (is_object($subsite)) {
         $subsiteID = $subsite->ID;
     } else {
         $subsiteID = $subsite;
     }
     Session::set('SubsiteID', (int) $subsiteID);
     // Set locale
     if (is_object($subsite) && $subsite->Language != '') {
         $locale = i18n::get_locale_from_lang($subsite->Language);
         if ($locale) {
             i18n::set_locale($locale);
         }
     }
     Permission::flush_permission_cache();
 }
开发者ID:hamaka,项目名称:silverstripe-subsites,代码行数:28,代码来源:Subsite.php


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