summaryrefslogtreecommitdiff
path: root/framework/Web/Security/TRoles.php
blob: 8072cb6416cb8d1ff0a90dbc517b64e4c948d0f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<?php
/**
 * TRoles class.
 *  Manages user membership in roles for authorization checking in an PRADO application. This class cannot be inherited.
 *
 * @author Jason Ragsdale <jrags@jasrags.net>
 * @version $Id: TRoles.php 1398 2006-09-08 19:31:03Z xue $
 * @package System.Web.Security
 * @since 3.1
 */
Prado::using('System.Web.Security.TProviderException');
final class TRoles
{
	private static $_applicationName;
	private static $_cacheRolesInCookie=false;
	private static $_cookieName;
	private static $_cookiePath;
	private static $_cookieProtectionValue;
	private static $_cookieRequireSSL=false;
	private static $_cookieSlidingExpiration=false;
	private static $_cookieTimeout;
	private static $_createPersistentCookie=false;
	private static $_domain;
	private static $_enabled=false;
	private static $_maxCachedResults;
	private static $_provider;
	private static $_providers;
	private static $_enabledSet=false;
	private static $_initialized=false;
	private static $_initializeException;

	public static function getApplicationName()
	{
		return self::$_applicationName;
	}
	public static function setApplicationName($value)
	{
		self::$_applicationName = TPropertyValue::ensureString($value);
	}
	public static function getCacheRolesInCookie()
	{
		return self::$_cacheRolesInCookie;
	}
	public static function getCookieName()
	{
		return self::$_cookieName;
	}
	public static function getCookiePath()
	{
		return self::$_cookiePath;
	}
	public static function getCookieProtectionValue()
	{
		return self::$_cookieProtectionValue;
	}
	public static function getCookieRequireSSL()
	{
		return self::$_cookieRequireSSL;
	}
	public static function getCookieSlidingExpiration()
	{
		return self::$_cookieSlidingExpiration;
	}
	public static function getCookieTimeout()
	{
		return self::$_cookieTimeout;
	}
	public static function getCreatePersistentCookie()
	{
		return self::$_createPersistentCookie;
	}
	public static function getDomain()
	{
		return self::$_domain;
	}
	public static function getEnabled()
	{
		return self::$_enabled;
	}
	public static function getMaxCachedResults()
	{
		return self::$_maxCachedResults;
	}
	public static function getProvider()
	{
		return self::$_provider;
	}
	public static function getProviders()
	{
		return self::$_providers;
	}

	public static function addUsersToRole($usernames,$roleName)
	{

	}
	public static function addUsersToRoles($usernames,$roleNames)
	{

	}
	public static function addUserToRole($username,$roleName)
	{

	}
	public static function addUserToRoles($username,$roleNames)
	{

	}
	public static function createRole($roleName)
	{
		self::ensureEnabled();
		self::$_provider->createRole($roleName);
	}
	public static function deleteCookie()
	{

	}
	public static function deleteRole($roleName,$throwOnPopulatedRole=true)
	{
		self::ensureEnabled();

		//		$flag1 = self::$_Provider->DeleteRole($roleName,$throwOnPopulatedRole);
		//		try
		//		{
		//			$principal1 = self::GetCurrentUser();
		//		}
		//		catch ()
		//		{
		//
		//		}

	}
	private static function ensureEnabled()
	{
		self::initialize();
		if (!self::$_Initialized)
		{
			throw new TProviderException('Roles_feature_not_enabled');
		}
	}
	public static function findUsersInRole($roleName,$usernameToMatch)
	{

	}
	public static function getAllRoles()
	{

	}
	private static function getCurrentUser()
	{

	}
	private static function getCurrentUserName()
	{

	}
	public static function getRolesForUser($username=null)
	{

	}
	public static function getUsersInRole($roleName)
	{

	}
	private static function initialize()
	{
		if (self::$_initialized)
		{
			if (self::$_initializeException!==null)
			{
				throw new $_initializeException;
			}
		}
		else
		{
			if (self::$_initialized)
			{
				if (self::$_initializeException!==null)
				{
					throw new $_initializeException;
				}
				return;
			}
			try 
			{
				self::$_enabled;
				self::$_cookieName;
				self::$_cookiePath;
				self::$_cacheRolesInCookie;
				self::$_cookieTimeout;
				self::$_cookiePath;
				self::$_cookieRequireSSL;
				self::$_cookieSlidingExpiration;
				self::$_cookieProtectionValue;
				self::$_domain;
				self::$_createPersistentCookie;
				self::$_maxCachedResults;
				if (self::$_enabled)
				{
					if (self::$_maxCachedResults < 0)
					{
						throw new TProviderException('Value_must_be_non_negative_integer',self::$_MaxCachedResults);
					}////stopped here
				}
			}
			catch (TException $e)
			{
				
			}
		}
	}
	public static function isUserInRole($roleName,$username=null)
	{

	}
	public static function removeUserFromRole($username,$roleName)
	{

	}
	public static function remoreUserFromRoles($username,$roleNames)
	{

	}
	public static function removeUsersFromRole($usernames,$roleName)
	{

	}
	public static function removeUsersFromRoles($usernames,$roleNames)
	{

	}
	public static function roleExists($roleName)
	{

	}
}
?>