Changeset 333:5e2fb991a74d
- Timestamp:
- 06/04/11 13:57:01 (14 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.auth.php
r312 r333 13 13 14 14 /** 15 @ingroup DC_CORE16 @nosubgrouping17 @brief Authentication and user credentials management18 19 dcAuth is a class used to handle everything related to user authentication20 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. 21 21 */ 22 22 class dcAuth 23 23 { 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 48 63 */ 49 64 public function __construct($core) … … 70 85 //@{ 71 86 /** 72 Checks if user exists and can log in. <var>$pwd</var> argument is optionnal73 while you may need to check user without password. This method will create74 credentials and populate all needed object properties.75 76 @param user_id <b>string</b>User ID77 @param pwd <b>string</b>User password78 @param user_key <b>string</b>User key check79 @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 81 96 */ 82 97 public function checkUser($user_id, $pwd=null, $user_key=null, $check_blog=true) … … 149 164 150 165 /** 151 This method only check current user password.152 153 @param pwd <b>string</b>User password154 @return <b>boolean</b>166 * This method only check current user password. 167 * 168 * @param string $pwd User password 169 * @return boolean 155 170 */ 156 171 public function checkPassword($pwd) … … 164 179 165 180 /** 166 This method checks if user session cookie exists167 168 @return <b>boolean</b>181 * This method checks if user session cookie exists 182 * 183 * @return boolean 169 184 */ 170 185 public function sessionExists() … … 174 189 175 190 /** 176 This method checks user session validity.177 178 @return <b>boolean</b>191 * This method checks user session validity. 192 * 193 * @return boolean 179 194 */ 180 195 public function checkSession($uid=null) … … 213 228 214 229 /** 215 Checks if user is super admin216 217 @return <b>boolean</b>230 * Checks if user is super admin 231 * 232 * @return boolean 218 233 */ 219 234 public function isSuperAdmin() … … 223 238 224 239 /** 225 Checks if user has permissions given in <var>$permissions</var> for blog226 <var>$blog_id</var>. <var>$permissions</var> is a coma separated list of227 permissions.228 229 @param permissions <b>string</b>Permissions list230 @param blog_id <b>string</b>Blog ID231 @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 232 247 */ 233 248 public function check($permissions,$blog_id) … … 258 273 259 274 /** 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 263 278 */ 264 279 public function allowPassChange() … … 313 328 //@{ 314 329 /** 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 319 335 */ 320 336 public function sudo($f) … … 347 363 //@{ 348 364 /** 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 356 373 */ 357 374 public function getPermissions($blog_id) … … 423 440 424 441 /** 425 Returns current user ID426 427 @return <b>string</b>442 * Returns current user ID 443 * 444 * @return string 428 445 */ 429 446 public function userID() … … 433 450 434 451 /** 435 Returns information about a user .436 437 @param n <b>string</b>Information name438 @return <b>string</b> Information value452 * Returns information about a user . 453 * 454 * @param string $n Information name 455 * @return string 439 456 */ 440 457 public function getInfo($n) … … 448 465 449 466 /** 450 Returns a specific user option451 452 @param n <b>string</b>Option name453 @return <b>string</b> Option value467 * Returns a specific user option 468 * 469 * @param string $n Option name 470 * @return string 454 471 */ 455 472 public function getOption($n) … … 462 479 463 480 /** 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 467 484 */ 468 485 public function getOptions() … … 475 492 //@{ 476 493 /** 477 Returns an array with permissions parsed from the string <var>$level</var>478 479 @param level <b>string</b>Permissions string480 @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 481 498 */ 482 499 public function parsePermissions($level) … … 493 510 494 511 /** 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 498 515 */ 499 516 public function getPermissionsTypes() … … 503 520 504 521 /** 505 Adds a new permission type.506 507 @param name <b>string</b>Permission name508 @param title <b>string</b>Permission title522 * Adds a new permission type. 523 * 524 * @param string $name Permission name 525 * @param string $title Permission title 509 526 */ 510 527 public function setPermissionType($name,$title) … … 517 534 //@{ 518 535 /** 519 Add a recover key to a specific user identified by its email and520 password.521 522 @param user_id <b>string</b>User ID523 @param user_email <b>string</b>User Email524 @return <b>string</b> Recover key536 * 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 525 542 */ 526 543 public function setRecoverKey($user_id,$user_email) … … 548 565 549 566 /** 550 Creates a new user password using recovery key. Returns an array:551 552 - user_email553 - user_id554 - new_pass555 556 @param recover_key <b>string</b>Recovery key557 @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 558 575 */ 559 576 public function recoverUserPassword($recover_key) … … 591 608 592 609 /** 593 Called after core->addUser594 @seedcCore::addUser595 @param cur <b>cursor</b>User cursor610 * Called after core->addUser 611 * @see dcCore::addUser 612 * @param cursor $cur User cursor 596 613 */ 597 614 public function afterAddUser($cur) {} 598 615 599 616 /** 600 Called after core->updUser601 @seedcCore::updUser602 @param id <b>string</b>User ID603 @param cur <b>cursor</b>User cursor617 * Called after core->updUser 618 * @see dcCore::updUser 619 * @param string $id User ID 620 * @param cursor $cur User cursor 604 621 */ 605 622 public function afterUpdUser($id,$cur) {} 606 623 607 624 /** 608 Called after core->delUser609 @seedcCore::delUser610 @param id <b>string</b>User ID625 * Called after core->delUser 626 * @see dcCore::delUser 627 * @param string $id User ID 611 628 */ 612 629 public function afterDelUser($id) {}
Note: See TracChangeset
for help on using the changeset viewer.