From b6e12bedc51b56cf0f1a5930e69a4c377cd3dfe5 Mon Sep 17 00:00:00 2001 From: jrags <> Date: Thu, 21 Sep 2006 00:57:53 +0000 Subject: Added providers demo, sqlmembershipprovider sqlroleprovider both load via modules now, but are not totaly functional yet. TLogin* controls created but not functional yet. --- framework/Web/Security/TRoles.php | 159 +++++++++++++++++++------------------- 1 file changed, 80 insertions(+), 79 deletions(-) (limited to 'framework/Web/Security/TRoles.php') diff --git a/framework/Web/Security/TRoles.php b/framework/Web/Security/TRoles.php index 5f4c4032..8072cb64 100644 --- a/framework/Web/Security/TRoles.php +++ b/framework/Web/Security/TRoles.php @@ -8,115 +8,116 @@ * @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; + 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; + return self::$_applicationName; } public static function setApplicationName($value) { - self::$_ApplicationName = TPropertyValue::ensureString($value); + self::$_applicationName = TPropertyValue::ensureString($value); } public static function getCacheRolesInCookie() { - return self::$_CacheRolesInCookie; + return self::$_cacheRolesInCookie; } public static function getCookieName() { - return self::$_CookieName; + return self::$_cookieName; } public static function getCookiePath() { - return self::$_CookiePath; + return self::$_cookiePath; } public static function getCookieProtectionValue() { - return self::$_CookieProtectionValue; + return self::$_cookieProtectionValue; } public static function getCookieRequireSSL() { - return self::$_CookieRequireSSL; + return self::$_cookieRequireSSL; } public static function getCookieSlidingExpiration() { - return self::$_CookieSlidingExpiration; + return self::$_cookieSlidingExpiration; } public static function getCookieTimeout() { - return self::$_CookieTimeout; + return self::$_cookieTimeout; } public static function getCreatePersistentCookie() { - return self::$_CreatePersistentCookie; + return self::$_createPersistentCookie; } public static function getDomain() { - return self::$_Domain; + return self::$_domain; } public static function getEnabled() { - return self::$_Enabled; + return self::$_enabled; } public static function getMaxCachedResults() { - return self::$_MaxCachedResults; + return self::$_maxCachedResults; } public static function getProvider() { - return self::$_Provider; + return self::$_provider; } public static function getProviders() { - return self::$_Providers; + return self::$_providers; } - public static function AddUsersToRole($usernames,$roleName) + public static function addUsersToRole($usernames,$roleName) { } - public static function AddUsersToRoles($usernames,$roleNames) + public static function addUsersToRoles($usernames,$roleNames) { } - public static function AddUserToRole($username,$roleName) + public static function addUserToRole($username,$roleName) { } - public static function AddUserToRoles($username,$roleNames) + public static function addUserToRoles($username,$roleNames) { } - public static function CreateRole($roleName) + public static function createRole($roleName) { - self::EnsureEnabled(); - self::$_Provider->CreateRole($roleName); + self::ensureEnabled(); + self::$_provider->createRole($roleName); } - public static function DeleteCookie() + public static function deleteCookie() { } - public static function DeleteRole($roleName,$throwOnPopulatedRole=true) + public static function deleteRole($roleName,$throwOnPopulatedRole=true) { - self::EnsureEnabled(); + self::ensureEnabled(); // $flag1 = self::$_Provider->DeleteRole($roleName,$throwOnPopulatedRole); // try @@ -129,76 +130,76 @@ final class TRoles // } } - private static function EnsureEnabled() + private static function ensureEnabled() { - self::Initialize(); + self::initialize(); if (!self::$_Initialized) { - throw new TException('Roles_feature_not_enabled'); + throw new TProviderException('Roles_feature_not_enabled'); } } - public static function FindUsersInRole($roleName,$usernameToMatch) + public static function findUsersInRole($roleName,$usernameToMatch) { } - public static function GetAllRoles() + public static function getAllRoles() { } - private static function GetCurrentUser() + private static function getCurrentUser() { } - private static function GetCurrentUserName() + private static function getCurrentUserName() { } - public static function GetRolesForUser($username=null) + public static function getRolesForUser($username=null) { } - public static function GetUsersInRole($roleName) + public static function getUsersInRole($roleName) { } - private static function Initialize() + private static function initialize() { - if (self::$_Initialized) + if (self::$_initialized) { - if (self::$_InitializeException!==null) + if (self::$_initializeException!==null) { - throw new $_s_InitializeException; + throw new $_initializeException; } } else { - if (self::$_Initialized) + if (self::$_initialized) { - if (self::$_InitializeException!==null) + if (self::$_initializeException!==null) { - throw new $_InitializeException; + 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) + 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) + if (self::$_maxCachedResults < 0) { - throw new TException('Value_must_be_non_negative_integer',self::$_MaxCachedResults); + throw new TProviderException('Value_must_be_non_negative_integer',self::$_MaxCachedResults); }////stopped here } } @@ -208,27 +209,27 @@ final class TRoles } } } - public static function IsUserInRole($roleName,$username=null) + public static function isUserInRole($roleName,$username=null) { } - public static function RemoveUserFromRole($username,$roleName) + public static function removeUserFromRole($username,$roleName) { } - public static function RemoreUserFromRoles($username,$roleNames) + public static function remoreUserFromRoles($username,$roleNames) { } - public static function RemoveUsersFromRole($usernames,$roleName) + public static function removeUsersFromRole($usernames,$roleName) { } - public static function RemoveUsersFromRoles($usernames,$roleNames) + public static function removeUsersFromRoles($usernames,$roleNames) { } - public static function RoleExists($roleName) + public static function roleExists($roleName) { } -- cgit v1.2.3