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