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