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