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