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