Dotclear

Changeset 333:5e2fb991a74d


Ignore:
Timestamp:
06/04/11 13:57:01 (14 years ago)
Author:
Alex Pirine <digimag@…>
Branch:
default
Message:

Improved code documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.auth.php

    r312 r333  
    1313 
    1414/** 
    15 @ingroup DC_CORE 
    16 @nosubgrouping 
    17 @brief Authentication and user credentials management 
    18  
    19 dcAuth is a class used to handle everything related to user authentication 
    20 and credentials. Object is provided by dcCore $auth property. 
     15* @ingroup DC_CORE 
     16* @nosubgrouping 
     17* @brief Authentication and user credentials management 
     18*  
     19* dcAuth is a class used to handle everything related to user authentication 
     20* and credentials. Object is provided by dcCore $auth property. 
    2121*/ 
    2222class dcAuth 
    2323{ 
    24      protected $core;         ///< <b>dcCore</b> dcCore instance 
    25      protected $con;          ///< <b>connection</b> Database connection object 
    26       
    27      protected $user_table;   ///< <b>string</b>  User table name 
    28      protected $perm_table;   ///< <b>string</b>  Perm table name 
    29       
    30      protected $user_id;                     ///< <b>string</b>       Current user ID 
    31      protected $user_info = array();         ///< <b>array</b>        Array with user information 
    32      protected $user_options = array();      ///< <b>array</b>        Array with user options 
    33      protected $user_change_pwd;             ///< <b>boolean</b>      User must change his password after login 
    34      protected $user_admin;                  ///< <b>boolean</b>      User is super admin 
    35      protected $permissions = array();       ///< <b>array</b>        Permissions for each blog 
    36      protected $allow_pass_change = true;    ///< <b>boolean</b>      User can change its password 
    37      protected $blogs = array();             ///< <b>array</b>        List of blogs on which the user has permissions 
    38      public $blog_count = null;                   ///< <b>integer</b>      Count of user blogs 
    39       
    40      protected $perm_types;   ///< <b>array</b> Permission types 
    41       
    42      public $user_prefs; ///< <b>dcPrefs</b> dcPrefs object 
    43       
    44      /** 
    45      Class constructor. Takes dcCore object as single argument. 
    46       
    47      @param    core      <b>dcCore</b>       dcCore object 
     24     /** @var dcCore dcCore instance */ 
     25     protected $core; 
     26     /** @var connection Database connection object */ 
     27     protected $con; 
     28      
     29     /** @var string User table name */ 
     30     protected $user_table; 
     31     /** @var string Perm table name */ 
     32     protected $perm_table; 
     33      
     34     /** @var string Current user ID */ 
     35     protected $user_id; 
     36     /** @var array Array with user information */ 
     37     protected $user_info = array(); 
     38     /** @var array Array with user options */ 
     39     protected $user_options = array(); 
     40     /** @var boolean User must change his password after login */ 
     41     protected $user_change_pwd; 
     42     /** @var boolean User is super admin */ 
     43     protected $user_admin; 
     44     /** @var array Permissions for each blog */ 
     45     protected $permissions = array(); 
     46     /** @var boolean User can change its password */ 
     47     protected $allow_pass_change = true; 
     48     /** @var array List of blogs on which the user has permissions */ 
     49     protected $blogs = array(); 
     50     /** @var integer Count of user blogs */ 
     51     public $blog_count = null; 
     52      
     53     /** @var array Permission types */ 
     54     protected $perm_types; 
     55      
     56     /** @var dcPrefs dcPrefs object */ 
     57     public $user_prefs; 
     58      
     59     /** 
     60     * Class constructor. Takes dcCore object as single argument. 
     61     *  
     62     * @param dcCore     $core          dcCore object 
    4863     */ 
    4964     public function __construct($core) 
     
    7085     //@{ 
    7186     /** 
    72      Checks if user exists and can log in. <var>$pwd</var> argument is optionnal 
    73      while you may need to check user without password. This method will create 
    74      credentials and populate all needed object properties. 
    75       
    76      @param    user_id   <b>string</b>       User ID 
    77      @param    pwd       <b>string</b>       User password 
    78      @param    user_key  <b>string</b>       User key check 
    79      @param    check_blog     <b>boolean</b>      checks if user is associated to a blog or not. 
    80      @return   <b>boolean</b> 
     87     * Checks if user exists and can log in. <var>$pwd</var> argument is optionnal 
     88     * while you may need to check user without password. This method will create 
     89     * credentials and populate all needed object properties. 
     90     *  
     91     * @param string     $user_id       User ID 
     92     * @param string     $pwd           User password 
     93     * @param string     $user_key      User key check 
     94     * @param boolean    $check_blog    checks if user is associated to a blog or not. 
     95     * @return boolean 
    8196     */ 
    8297     public function checkUser($user_id, $pwd=null, $user_key=null, $check_blog=true) 
     
    149164      
    150165     /** 
    151      This method only check current user password. 
    152       
    153      @param    pwd       <b>string</b>       User password 
    154      @return   <b>boolean</b> 
     166     * This method only check current user password. 
     167     *  
     168     * @param string     $pwd           User password 
     169     * @return boolean 
    155170     */ 
    156171     public function checkPassword($pwd) 
     
    164179      
    165180     /** 
    166      This method checks if user session cookie exists 
    167       
    168      @return   <b>boolean</b> 
     181     * This method checks if user session cookie exists 
     182     *  
     183     * @return boolean 
    169184     */ 
    170185     public function sessionExists() 
     
    174189      
    175190     /** 
    176      This method checks user session validity. 
    177       
    178      @return   <b>boolean</b> 
     191     * This method checks user session validity. 
     192     *  
     193     * @return boolean 
    179194     */ 
    180195     public function checkSession($uid=null) 
     
    213228      
    214229     /** 
    215      Checks if user is super admin 
    216       
    217      @return   <b>boolean</b> 
     230     * Checks if user is super admin 
     231     *  
     232     * @return boolean 
    218233     */ 
    219234     public function isSuperAdmin() 
     
    223238      
    224239     /** 
    225      Checks if user has permissions given in <var>$permissions</var> for blog 
    226      <var>$blog_id</var>. <var>$permissions</var> is a coma separated list of 
    227      permissions. 
    228       
    229      @param    permissions    <b>string</b>       Permissions list 
    230      @param    blog_id        <b>string</b>       Blog ID 
    231      @return   <b>boolean</b> 
     240     * Checks if user has permissions given in <var>$permissions</var> for blog 
     241     * <var>$blog_id</var>. <var>$permissions</var> is a coma separated list of 
     242     * permissions. 
     243     *  
     244     * @param string     $permissions   Permissions list 
     245     * @param string     $blog_id       Blog ID 
     246     * @return boolean 
    232247     */ 
    233248     public function check($permissions,$blog_id) 
     
    258273      
    259274     /** 
    260      Returns true if user is allowed to change its password. 
    261       
    262      @return   <b>boolean</b> 
     275     * Returns true if user is allowed to change its password. 
     276     *  
     277     * @return boolean 
    263278     */ 
    264279     public function allowPassChange() 
     
    313328     //@{ 
    314329     /** 
    315      Calls <var>$f</var> function with super admin rights. 
    316       
    317      @param    f         <b>callback</b>     Callback function 
    318      @return   <b>mixed</b> Function result 
     330     * Calls $f function with super admin rights. 
     331     * Returns the function result. 
     332     *  
     333     * @param callback   $f             Callback function 
     334     * @return mixed 
    319335     */ 
    320336     public function sudo($f) 
     
    347363     //@{ 
    348364     /** 
    349      Returns user permissions for a blog as an array which looks like: 
    350       
    351       - [blog_id] 
    352         - [permission] => true 
    353         - ... 
    354       
    355      @return   <b>array</b> 
     365     * Returns user permissions for a blog as an array which looks like: 
     366     *  
     367     *  - [blog_id] 
     368     *    - [permission] => true 
     369     *    - ... 
     370     *  
     371     * @param string     $blog_id       Blog ID 
     372     * @return array 
    356373     */ 
    357374     public function getPermissions($blog_id) 
     
    423440      
    424441     /** 
    425      Returns current user ID 
    426       
    427      @return   <b>string</b> 
     442     * Returns current user ID 
     443     *  
     444     * @return string 
    428445     */ 
    429446     public function userID() 
     
    433450      
    434451     /** 
    435      Returns information about a user . 
    436       
    437      @param    n         <b>string</b>       Information name 
    438      @return   <b>string</b> Information value 
     452     * Returns information about a user . 
     453     *  
     454     * @param string     $n             Information name 
     455     * @return string 
    439456     */ 
    440457     public function getInfo($n) 
     
    448465      
    449466     /** 
    450      Returns a specific user option 
    451       
    452      @param    n         <b>string</b>       Option name 
    453      @return   <b>string</b> Option value 
     467     * Returns a specific user option 
     468     *  
     469     * @param string     $n             Option name 
     470     * @return string 
    454471     */ 
    455472     public function getOption($n) 
     
    462479      
    463480     /** 
    464      Returns all user options in an associative array. 
    465       
    466      @return   <b>array</b> 
     481     * Returns all user options in an associative array. 
     482     *  
     483     * @return array 
    467484     */ 
    468485     public function getOptions() 
     
    475492     //@{ 
    476493     /** 
    477      Returns an array with permissions parsed from the string <var>$level</var> 
    478       
    479      @param    level     <b>string</b>       Permissions string 
    480      @return   <b>array</b> 
     494     * Returns an array with permissions parsed from the string <var>$level</var> 
     495     *  
     496     * @param string     $level         Permissions string 
     497     * @return array 
    481498     */ 
    482499     public function parsePermissions($level) 
     
    493510      
    494511     /** 
    495      Returns <var>perm_types</var> property content. 
    496       
    497      @return   <b>array</b> 
     512     * Returns <var>perm_types</var> property content. 
     513     *  
     514     * @return array 
    498515     */ 
    499516     public function getPermissionsTypes() 
     
    503520      
    504521     /** 
    505      Adds a new permission type. 
    506       
    507      @param    name      <b>string</b>       Permission name 
    508      @param    title     <b>string</b>       Permission title 
     522     * Adds a new permission type. 
     523     *  
     524     * @param string     $name          Permission name 
     525     * @param string     $title         Permission title 
    509526     */ 
    510527     public function setPermissionType($name,$title) 
     
    517534     //@{ 
    518535     /** 
    519      Add a recover key to a specific user identified by its email and 
    520      password. 
    521       
    522      @param    user_id        <b>string</b>       User ID 
    523      @param    user_email     <b>string</b>       User Email 
    524      @return   <b>string</b> Recover key 
     536     * Add a recover key to a specific user identified by its email and 
     537     * password. 
     538     *  
     539     * @param string     $user_id       User ID 
     540     * @param string     $user_email    User Email 
     541     * @return string 
    525542     */ 
    526543     public function setRecoverKey($user_id,$user_email) 
     
    548565      
    549566     /** 
    550      Creates a new user password using recovery key. Returns an array: 
    551       
    552      - user_email 
    553      - user_id 
    554      - new_pass 
    555       
    556      @param    recover_key    <b>string</b>       Recovery key 
    557      @return   <b>array</b> 
     567     * Creates a new user password using recovery key. Returns an array: 
     568     *  
     569     * - user_email 
     570     * - user_id 
     571     * - new_pass 
     572     *  
     573     * @param string     $recover_key   Recovery key 
     574     * @return array 
    558575     */ 
    559576     public function recoverUserPassword($recover_key) 
     
    591608      
    592609     /** 
    593      Called after core->addUser 
    594      @see      dcCore::addUser 
    595      @param    cur       <b>cursor</b>       User cursor 
     610     * Called after core->addUser 
     611     * @see dcCore::addUser 
     612     * @param cursor     $cur           User cursor 
    596613     */ 
    597614     public function afterAddUser($cur) {} 
    598615      
    599616     /** 
    600      Called after core->updUser 
    601      @see      dcCore::updUser 
    602      @param    id        <b>string</b>       User ID 
    603      @param    cur       <b>cursor</b>       User cursor 
     617     * Called after core->updUser 
     618     * @see dcCore::updUser 
     619     * @param string     $id            User ID 
     620     * @param cursor     $cur           User cursor 
    604621     */ 
    605622     public function afterUpdUser($id,$cur) {} 
    606623      
    607624     /** 
    608      Called after core->delUser 
    609      @see      dcCore::delUser 
    610      @param    id        <b>string</b>       User ID 
     625     * Called after core->delUser 
     626     * @see dcCore::delUser 
     627     * @param string     $id            User ID 
    611628     */ 
    612629     public function afterDelUser($id) {} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map