Source for file OCSP_SHELLUSER.phpclass

Documentation is available at OCSP_SHELLUSER.phpclass

  1. <?php
  2. /**
  3.   * openCSP class file OCSP_SHELLUSER.phpclass
  4.   *
  5.   * @project Open CSP-Management
  6.   * @package default
  7.   *
  8.   * @author Peter Krebs <pitlinz@users.sourceforge.net>
  9.   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  10.   *
  11.   * @since pk-04.12.2008
  12.   * @version $Id: OCSP_SHELLUSER.phpclass,v 1.1 2008/12/06 11:22:01 pitlinz Exp $
  13.   */
  14.  
  15.     // ---------------------------------------------------------
  16.     // requirements
  17.     // ---------------------------------------------------------
  18.  
  19.     pcf_require_class('OCSP_USER',"user/");
  20.  
  21. /**
  22.   * openCSP class OCSP_SHELLUSER
  23.   * 
  24.   * user running a script from the shell
  25.   * this user is assumed to be admin
  26.   *
  27.   * @project Open CSP-Management
  28.   * @package default
  29.   *
  30.   * @author Peter Krebs <pitlinz@users.sourceforge.net>
  31.   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  32.   *
  33.   * @since pk-04.12.2008
  34.   * @version $Id: OCSP_SHELLUSER.phpclass,v 1.1 2008/12/06 11:22:01 pitlinz Exp $
  35.   */
  36. class OCSP_SHELLUSER extends OCSP_USER
  37. {
  38.     // ---------------------------------------------------------------------------
  39.     // constants
  40.     // ---------------------------------------------------------------------------
  41.     
  42.     /**
  43.      * @constant string CLASS_SRC_FILE
  44.      */
  45.     const CLASS_SRC_FILE = __FILE__;
  46.  
  47.     // ---------------------------------------------------------------------------
  48.     // class (static)
  49.     // ---------------------------------------------------------------------------
  50.     
  51.     /*** class vars ------------------------------------------------------ */
  52.     
  53.     /*** class methods --------------------------------------------------- */
  54.     
  55.     static function setCurrent(&$aUser)
  56.     {
  57.         self::$global_currentUser=$aUser;
  58.     }
  59.     
  60.     // ---------------------------------------------------------------------------
  61.     // object vars
  62.     // ---------------------------------------------------------------------------
  63.     
  64.     /*** compostion --------------------------------------------------- */
  65.     
  66.     /*** attributes  -------------------------------------------------- */
  67.     
  68.     // ---------------------------------------------------------------------------
  69.     // factory / construct
  70.     // ---------------------------------------------------------------------------
  71.     
  72.     public function __construct()
  73.     {
  74.         if (isset($_SERVER['HTTP_HOST']))
  75.         {
  76.             throw new Exception("HTTP_HOST isset operation not permitted");
  77.         }
  78.         
  79.         $this->USR_ID=1;
  80.         $this->USR_LOGIN='SYSTEM';
  81.         $this->USR_ENABLED 1;
  82.         $this->GRP_ID _OCSP_GROUP_ADMIN_;    
  83.  
  84.         OCSP_SHELLUSER::setCurrent($this);
  85.         
  86.     }
  87.     
  88.     // ---------------------------------------------------------------------------
  89.     // getter / setter
  90.     // ---------------------------------------------------------------------------    
  91.  
  92.    /**
  93.      * returns if the user is public or is a logined user
  94.      * 
  95.      * cronjob runs as system user (userid 1)
  96.      *
  97.      * @param boolean $debug 
  98.      * 
  99.      * @return boolean 
  100.      *
  101.      */
  102.     function isPublic($debug=False)
  103.     {
  104.         if ($debugechoDebugMethod(__FILE__,get_class($this),"OCSP_SHELLUSER::isPublic()");        
  105.         return False;
  106.     }
  107.     
  108.    /**
  109.      * @return boolean 
  110.      */
  111.     function isValid($debug=False)
  112.     {
  113.         if ($debugechoDebugMethod(__FILE__,get_class($this),"OCSP_SHELLUSER::isValid()");
  114.         return True;    
  115.     }    
  116.     
  117.     /**
  118.      * returns if the user is enabled by default
  119.      * 
  120.      * NOTE: does not check current page settings
  121.      *
  122.      * @param  $debug 
  123.      * @return boolean 
  124.      */
  125.     function isEnabled($debug=False)
  126.     {
  127.         if ($debugechoDebugMethod(__FILE__,get_class($this),"OCSP_SHELLUSER::isEnabled()");
  128.         return True;    
  129.     }
  130.     
  131.     /**
  132.      * checks the user against a merge of $this->curSecReq and $addSecReq
  133.      * 
  134.      * @param array $addSecReq 
  135.      *
  136.      * @return boolean 
  137.      *
  138.      * @since pk-06-08-15
  139.      *
  140.      */
  141.     function isAllowed($addSecReq=NULL,$debug=False
  142.     {
  143.         if ($debugechoDebugMethod(__FILE__,get_class($this),"OCSP_SHELLUSER::isAllowed()");
  144.         return True;
  145.     }
  146.     
  147.     // ---------------------------------------------------------
  148.     // group methods
  149.     // ---------------------------------------------------------    
  150.         
  151.     /**
  152.      * returns if a user is admin
  153.      *
  154.      * @param boolean $debug 
  155.      * @return boolean 
  156.      *
  157.      ***/
  158.     public function isAdmin($debug=False{
  159.         if ($debugechoDebugMethod(__FILE__,get_class($this),"OCSP_SHELLUSER::isAdmin()");
  160.         return True;
  161.     }    
  162.     
  163.     // ---------------------------------------------------------
  164.     // session methods
  165.     // ---------------------------------------------------------    
  166.     
  167.    /**
  168.      * stores the user to the session
  169.      *
  170.      * @param boolean $debug 
  171.      * 
  172.      * @version pk-08-06-11 store only if $this is current user
  173.      */
  174.     public function sessSave($debug=False)
  175.     {
  176.         // do nothing        
  177.     }
  178.     
  179. }
  180.  
  181. ?>

Documentation generated on Thu, 08 Jan 2009 17:47:09 +0100 by phpDocumentor 1.4.0a2