根据concrete5中的页面权限编辑autonav输出

时间:2011-10-21 14:22:55

标签: php permissions concrete5

我需要更改autonav块的输出。 我已经设置了我自己的模板没有问题,但我需要autonav来突出显示登录用户可以访问的页面。

例如,我有二级访问权限,所以当我看到页面列表时,页面列表会突出显示我可以访问的页面,但客人甚至看不到。

$permissions = new Permissions($_c);

if ($permissions->canRead()) {
    echo '<a class="highlight">'.$ni->getName().'</a>';
} else {
    echo $ni->getName();
}

这不起作用,因为如果我是level2,我可以读取所有页面的访问权限。

此特定页面的权限设置为仅允许级别2访问

var_dump(Page::getById(142));

// Generates:

object(Page)[345]
  protected 'blocksAliasedFromMasterCollection' => null
  public 'cID' => string '142' (length=3)
  protected 'attributes' => 
    array
      empty
  public 'error' => string '' (length=0)
  public 'pkgID' => string '0' (length=1)
  public 'cPointerID' => string '0' (length=1)
  public 'cPointerExternalLink' => null
  public 'cPointerExternalLinkNewWindow' => string '0' (length=1)
  public 'cFilename' => null
  public 'cDateAdded' => string '2011-10-20 16:50:38' (length=19)
  public 'cDisplayOrder' => string '10' (length=2)
  public 'cDateModified' => string '2011-10-20 17:03:54' (length=19)
  public 'cInheritPermissionsFromCID' => string '142' (length=3)
  public 'cInheritPermissionsFrom' => string 'OVERRIDE' (length=8)
  public 'cOverrideTemplatePermissions' => string '1' (length=1)
  public 'cPendingAction' => null
  public 'cPendingActionUID' => null
  public 'cPendingActionTargetCID' => null
  public 'cPendingActionDatetime' => string '0000-00-00 00:00:00' (length=19)
  public 'cCheckedOutUID' => null
  public 'cIsTemplate' => string '0' (length=1)
  public 'uID' => string '5' (length=1)
  public 'cPath' => string '/link-to' (length=8)
  public 'ctID' => string '3' (length=1)
  public 'ctHandle' => string 'full' (length=4)
  public 'ctIcon' => string 'main.png' (length=8)
  public 'ptID' => string '4' (length=1)
  public 'cParentID' => string '1' (length=1)
  public 'cChildren' => string '0' (length=1)
  public 'ctName' => string 'Full Width' (length=10)
  public 'cCacheFullPageContent' => string '-1' (length=2)
  public 'cCacheFullPageContentOverrideLifetime' => string '0' (length=1)
  public 'cCacheFullPageContentLifetimeCustom' => string '0' (length=1)
  public 'isMasterCollection' => string '0' (length=1)
  public 'vObj' => 
    object(CollectionVersion)[348]
      public 'cvIsApproved' => string '1' (length=1)
      public 'cID' => string '142' (length=3)
      protected 'attributes' => 
        object(AttributeValueList)[350]
          private 'attributes' => 
            array
              'meta_title' => string '' (length=0)
              'meta_description' => string '' (length=0)
              'meta_keywords' => string '' (length=0)
              'exclude_nav' => string '1' (length=1)
          public 'error' => string '' (length=0)
      public 'customAreaStyles' => 
        array
          empty
      public 'layoutStyles' => 
        array
          empty
      public 'error' => string '' (length=0)
      public 'cvID' => string '4' (length=1)
      public 'cvIsNew' => string '0' (length=1)
      public 'cvHandle' => string 'link-to' (length=7)
      public 'cvName' => string 'Link To' (length=7)
      public 'cvDescription' => string '' (length=0)
      public 'cvDateCreated' => string '2011-10-20 17:03:40' (length=19)
      public 'cvDatePublic' => string '2011-10-20 16:50:00' (length=19)
      public 'cvAuthorUID' => string '5' (length=1)
      public 'cvApproverUID' => string '5' (length=1)
      public 'cvComments' => string 'New Version 4' (length=13)
      public 'cvIsMostRecent' => boolean true


$inspectC=Page::getById(142);
$p = new Permissions($inspectC);
var_dump($p);    

// Generates:

object(Permissions)[1190]
  public 'permissionSet' => string 'r' (length=1)
  public 'permError' => null
  public 'originalObj' => 
    object(Page)[345]
      protected 'blocksAliasedFromMasterCollection' => null
      public 'cID' => string '142' (length=3)
      protected 'attributes' => 
        array
          empty
      public 'error' => string '' (length=0)
      public 'pkgID' => string '0' (length=1)
      public 'cPointerID' => string '0' (length=1)
      public 'cPointerExternalLink' => null
      public 'cPointerExternalLinkNewWindow' => string '0' (length=1)
      public 'cFilename' => null
      public 'cDateAdded' => string '2011-10-20 16:50:38' (length=19)
      public 'cDisplayOrder' => string '10' (length=2)
      public 'cDateModified' => string '2011-10-20 17:03:54' (length=19)
      public 'cInheritPermissionsFromCID' => string '142' (length=3)
      public 'cInheritPermissionsFrom' => string 'OVERRIDE' (length=8)
      public 'cOverrideTemplatePermissions' => string '1' (length=1)
      public 'cPendingAction' => null
      public 'cPendingActionUID' => null
      public 'cPendingActionTargetCID' => null
      public 'cPendingActionDatetime' => string '0000-00-00 00:00:00' (length=19)
      public 'cCheckedOutUID' => null
      public 'cIsTemplate' => string '0' (length=1)
      public 'uID' => string '5' (length=1)
      public 'cPath' => string '/link-to' (length=8)
      public 'ctID' => string '3' (length=1)
      public 'ctHandle' => string 'full' (length=4)
      public 'ctIcon' => string 'main.png' (length=8)
      public 'ptID' => string '4' (length=1)
      public 'cParentID' => string '1' (length=1)
      public 'cChildren' => string '0' (length=1)
      public 'ctName' => string 'Full Width' (length=10)
      public 'cCacheFullPageContent' => string '-1' (length=2)
      public 'cCacheFullPageContentOverrideLifetime' => string '0' (length=1)
      public 'cCacheFullPageContentLifetimeCustom' => string '0' (length=1)
      public 'isMasterCollection' => string '0' (length=1)
      public 'vObj' => 
        object(CollectionVersion)[348]
          public 'cvIsApproved' => string '1' (length=1)
          public 'cID' => string '142' (length=3)
          protected 'attributes' => 
            object(AttributeValueList)[350]
              private 'attributes' => 
                array
                  'meta_title' => string '' (length=0)
                  'meta_description' => string '' (length=0)
                  'meta_keywords' => string '' (length=0)
                  'exclude_nav' => string '1' (length=1)
              public 'error' => string '' (length=0)
          public 'customAreaStyles' => 
            array
              empty
          public 'layoutStyles' => 
            array
              empty
          public 'error' => string '' (length=0)
          public 'cvID' => string '4' (length=1)
          public 'cvIsNew' => string '0' (length=1)
          public 'cvHandle' => string 'link-to' (length=7)
          public 'cvName' => string 'Link To' (length=7)
          public 'cvDescription' => string '' (length=0)
          public 'cvDateCreated' => string '2011-10-20 17:03:40' (length=19)
          public 'cvDatePublic' => string '2011-10-20 16:50:00' (length=19)
          public 'cvAuthorUID' => string '5' (length=1)
          public 'cvApproverUID' => string '5' (length=1)
          public 'cvComments' => string 'New Version 4' (length=13)
          public 'cvIsMostRecent' => boolean true
  public 'addCollectionTypes' => 
    array
      empty
  public 'addBlockTypes' => 
    array
      empty
  public 'oUID' => string '5' (length=1)
  public 'error' => string '' (length=0)
  public 'u' => 
    object(User)[1193]
      public 'uID' => string '7' (length=1)
      public 'uName' => string 'alex' (length=12)
      public 'uGroups' => 
        array
          2 => string '2' (length=1)
          5 => string 'Senior Professionals (Level 2)' (length=30)
          1 => string '1' (length=1)
      public 'superUser' => boolean false
      public 'uTimezone' => null
      protected 'uDefaultLanguage' => null
      public 'error' => string '' (length=0)
  public 'permissions' => null

0 个答案:

没有答案