Source for file IUser.php

Documentation is available at IUser.php

  1. 1: <?php
  2. 2:  
  3. 3: /**
  4. 4:  * Nette Framework
  5. 5:  *
  6. 6:  * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
  7. 7:  *
  8. 8:  * This source file is subject to the "Nette license" that is bundled
  9. 9:  * with this package in the file license.txt.
  10. 10:  *
  11. 11:  * For more information please see http://nettephp.com
  12. 12:  *
  13. 13:  * @copyright  Copyright (c) 2004, 2009 David Grudl
  14. 14:  * @license    http://nettephp.com/license  Nette license
  15. 15:  * @link       http://nettephp.com
  16. 16:  * @category   Nette
  17. 17:  * @package    Nette\Web
  18. 18:  */
  19. 19:  
  20. 20:  
  21. 21:  
  22. 22: /**
  23. 23:  * Authentication and authorization.
  24. 24:  *
  25. 25:  * @author     David Grudl
  26. 26:  * @copyright  Copyright (c) 2004, 2009 David Grudl
  27. 27:  * @package    Nette\Web
  28. 28:  */
  29. 29: interface IUser
  30. 30: {
  31. 31:  
  32. 32:     /**
  33. 33:      * Conducts the authentication process.
  34. 34:      * @param  string 
  35. 35:      * @param  string 
  36. 36:      * @param  mixed 
  37. 37:      * @return void 
  38. 38:      * @throws AuthenticationException if authentication was not successful
  39. 39:      */
  40. 40:     function authenticate($username$password$extra NULL);
  41. 41:  
  42. 42:     /**
  43. 43:      * Logs off the user from the current session.
  44. 44:      * @return void 
  45. 45:      */
  46. 46:     function signOut($clearIdentity FALSE);
  47. 47:  
  48. 48:     /**
  49. 49:      * Is this user authenticated?
  50. 50:      * @return bool 
  51. 51:      */
  52. 52:     function isAuthenticated();
  53. 53:  
  54. 54:     /**
  55. 55:      * Returns current user identity, if any.
  56. 56:      * @return IIdentity 
  57. 57:      */
  58. 58:     function getIdentity();
  59. 59:  
  60. 60:     /**
  61. 61:      * Sets authentication handler.
  62. 62:      * @param  IAuthenticator 
  63. 63:      * @return void 
  64. 64:      */
  65. 65:     function setAuthenticationHandler(IAuthenticator $handler);
  66. 66:  
  67. 67:     /**
  68. 68:      * Returns authentication handler.
  69. 69:      * @return IAuthenticator 
  70. 70:      */
  71. 71:     function getAuthenticationHandler();
  72. 72:  
  73. 73:     /**
  74. 74:      * Changes namespace; allows more users to share a session.
  75. 75:      * @param  string 
  76. 76:      * @return void 
  77. 77:      */
  78. 78:     function setNamespace($namespace);
  79. 79:  
  80. 80:     /**
  81. 81:      * Returns current namespace.
  82. 82:      * @return string 
  83. 83:      */
  84. 84:     function getNamespace();
  85. 85:  
  86. 86:     /**
  87. 87:      * Returns a list of roles that a user has been granted.
  88. 88:      * @return array 
  89. 89:      */
  90. 90:     function getRoles();
  91. 91:  
  92. 92:     /**
  93. 93:      * Is a user in the specified role?
  94. 94:      * @param  string 
  95. 95:      * @return bool 
  96. 96:      */
  97. 97:     function isInRole($role);
  98. 98:  
  99. 99:     /**
  100. 100:      * Has a user access to the Resource?
  101. 101:      * @return bool 
  102. 102:      */
  103. 103:     function isAllowed();
  104. 104:  
  105. 105:     /**
  106. 106:      * Sets authorization handler.
  107. 107:      * @param  IAuthorizator 
  108. 108:      * @return void 
  109. 109:      */
  110. 110:     function setAuthorizationHandler(IAuthorizator $handler);
  111. 111:  
  112. 112:     /**
  113. 113:      * Returns current authorization handler.
  114. 114:      * @return IAuthorizator 
  115. 115:      */
  116. 116:     function getAuthorizationHandler();
  117. 117: