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