1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004, 2011 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\Http;
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 mixed optional parameter (e.g. username)
29: * @param mixed optional parameter (e.g. password)
30: * @return void
31: * @throws Nette\Security\AuthenticationException if authentication was not successful
32: */
33: function login();
34:
35: /**
36: * Logs out the user from the current session.
37: * @return void
38: */
39: function logout($clearIdentity = FALSE);
40:
41: /**
42: * Is this user authenticated?
43: * @return bool
44: */
45: function isLoggedIn();
46:
47: /**
48: * Returns current user identity, if any.
49: * @return Nette\Security\IIdentity
50: */
51: function getIdentity();
52:
53: /**
54: * Sets authentication handler.
55: * @param Nette\Security\IAuthenticator
56: * @return void
57: */
58: function setAuthenticator(Nette\Security\IAuthenticator $handler);
59:
60: /**
61: * Returns authentication handler.
62: * @return Nette\Security\IAuthenticator
63: */
64: function getAuthenticator();
65:
66: /**
67: * Changes namespace; allows more users to share a session.
68: * @param string
69: * @return void
70: */
71: function setNamespace($namespace);
72:
73: /**
74: * Returns current namespace.
75: * @return string
76: */
77: function getNamespace();
78:
79: /**
80: * Returns a list of roles that a user has been granted.
81: * @return array
82: */
83: function getRoles();
84:
85: /**
86: * Is a user in the specified role?
87: * @param string
88: * @return bool
89: */
90: function isInRole($role);
91:
92: /**
93: * Has a user access to the Resource?
94: * @return bool
95: */
96: function isAllowed();
97:
98: /**
99: * Sets authorization handler.
100: * @param Nette\Security\IAuthorizator
101: * @return void
102: */
103: function setAuthorizator(Nette\Security\IAuthorizator $handler);
104:
105: /**
106: * Returns current authorization handler.
107: * @return Nette\Security\IAuthorizator
108: */
109: function getAuthorizator();
110:
111: }
112: