public function CheckPermission($Permission, $FullMatch = TRUE, $JunctionTable = '', $JunctionID = '') {
      if (is_object($this->User)) {
         if ($this->User->Banned || GetValue('Deleted', $this->User))
            return FALSE;
         elseif ($this->User->Admin)
            return TRUE;
      }

      // Allow wildcard permission checks (e.g. 'any' Category)
      if ($JunctionID == 'any')
         $JunctionID = '';

      $Permissions = $this->GetPermissions();
      if ($JunctionTable && !C('Garden.Permissions.Disabled.'.$JunctionTable)) {
         // Junction permission ($Permissions[PermissionName] = array(JunctionIDs))
         if (is_array($Permission)) {
            foreach ($Permission as $PermissionName) {
               if($this->CheckPermission($PermissionName, FALSE, $JunctionTable, $JunctionID)) {
						if(!$FullMatch)
							return TRUE;
					} else {
						if($FullMatch)
							return FALSE;
					}
            }
            return TRUE;
         } else {
            if ($JunctionID !== '') {
               $Result = array_key_exists($Permission, $Permissions)
                  && is_array($Permissions[$Permission])
                  && in_array($JunctionID, $Permissions[$Permission]);
            } else {
               $Result = array_key_exists($Permission, $Permissions)
                  && is_array($Permissions[$Permission])
                  && count($Permissions[$Permission]);
            }
            return $Result;
         }
      } else {
         // Non-junction permission ($Permissions = array(PermissionNames))
         if (is_array($Permission)) {
            return ArrayInArray($Permission, $Permissions, $FullMatch);
         } else {
            return in_array($Permission, $Permissions) || array_key_exists($Permission, $Permissions);
         }
      }
   }
public function CheckPermission($Permission, $FullMatch = TRUE, $JunctionTable = '', $JunctionID = '') {
      if (is_object($this->User)) {
         if ($this->User->Banned || GetValue('Deleted', $this->User))
            return FALSE;
         elseif ($this->User->Admin)
            return TRUE;
      }

      // Allow wildcard permission checks (e.g. 'any' Category)
      if ($JunctionID == 'any')
         $JunctionID = '';

      $Permissions = $this->GetPermissions();
      if ($JunctionTable && !C('Garden.Permissions.Disabled.'.$JunctionTable)) {
         // Junction permission ($Permissions[PermissionName] = array(JunctionIDs))
         if (is_array($Permission)) {
            foreach ($Permission as $PermissionName) {
               if($this->CheckPermission($PermissionName, FALSE, $JunctionTable, $JunctionID)) {
						if(!$FullMatch)
							return TRUE;
					} else {
						if($FullMatch)
							return FALSE;
					}
            }
            return TRUE;
         } else {
            if ($JunctionID !== '') {
               $Result = array_key_exists($Permission, $Permissions)
                  && is_array($Permissions[$Permission])
                  && in_array($JunctionID, $Permissions[$Permission]);
            } else {
               $Result = array_key_exists($Permission, $Permissions)
                  && is_array($Permissions[$Permission])
                  && count($Permissions[$Permission]);
            }
            return $Result;
         }
      } else {
         // Non-junction permission ($Permissions = array(PermissionNames))
         if (is_array($Permission)) {
            return ArrayInArray($Permission, $Permissions, $FullMatch);
         } else {
            return in_array($Permission, $Permissions) || array_key_exists($Permission, $Permissions);
         }
      }
   }
public function CheckPermission ( $ Permission , $ FullMatch = TRUE , $ JunctionTable = '' , $ JunctionID = '' ) { if ( is_object ( $ this -> User ) ) { if ( $ this -> User -> Banned || GetValue ( 'Deleted' , $ this -> User ) ) return FALSE ; elseif ( $ this -> User -> Admin ) return TRUE ; } // Allow wildcard permission checks (e.g. 'any' Category) if ( $ JunctionID == 'any' ) $ JunctionID = '' ; $ Permissions = $ this -> GetPermissions ( ) ; if ( $ JunctionTable && ! C ( 'Garden.Permissions.Disabled.' . $ JunctionTable ) ) { // Junction permission ($Permissions[PermissionName] = array(JunctionIDs)) if ( is_array ( $ Permission ) ) { foreach ( $ Permission as $ PermissionName ) { if ( $ this -> CheckPermission ( $ PermissionName , FALSE , $ JunctionTable , $ JunctionID ) ) { if ( ! $ FullMatch ) return TRUE ; } else { if ( $ FullMatch ) return FALSE ; } } return TRUE ; } else { if ( $ JunctionID !== '' ) { $ Result = array_key_exists ( $ Permission , $ Permissions ) && is_array ( $ Permissions [ $ Permission ] ) && in_array ( $ JunctionID , $ Permissions [ $ Permission ] ) ; } else { $ Result = array_key_exists ( $ Permission , $ Permissions ) && is_array ( $ Permissions [ $ Permission ] ) && count ( $ Permissions [ $ Permission ] ) ; } return $ Result ; } } else { // Non-junction permission ($Permissions = array(PermissionNames)) if ( is_array ( $ Permission ) ) { return ArrayInArray ( $ Permission , $ Permissions , $ FullMatch ) ; } else { return in_array ( $ Permission , $ Permissions ) || array_key_exists ( $ Permission , $ Permissions ) ; } } }
Checks the currently authenticated user's permissions for the specified
permission. Returns a boolean value indicating if the action is
permitted.

@param mixed $Permission The permission (or array of permissions) to check.
@param int $JunctionID The JunctionID associated with $Permission (ie. A discussion category identifier).
@param bool $FullMatch If $Permission is an array, $FullMatch indicates if all permissions specified are required. If false, the user only needs one of the specified permissions.
@param string $JunctionTable The name of the junction table for a junction permission.
@param in $JunctionID The ID of the junction permission.
* @return boolean
Checks the currently authenticated user s permissions for the specified permission . Returns a boolean value indicating if the action is permitted .