diff options
19 files changed, 1054 insertions, 0 deletions
| diff --git a/.gitattributes b/.gitattributes index 5fb733ae..406796e4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1294,6 +1294,8 @@ framework/Collections/TPagedDataSource.php -text  framework/Collections/TPagedList.php -text  framework/Collections/TQueue.php -text  framework/Collections/TStack.php -text +framework/Configuration/Provider/TProviderBase.php -text +framework/Configuration/Provider/TProviderException.php -text  framework/DataAccess/SQLMap/Configuration/TConfigDeserialize.php -text  framework/DataAccess/SQLMap/Configuration/TDiscriminator.php -text  framework/DataAccess/SQLMap/Configuration/TDomSqlMapBuilder.php -text @@ -1755,6 +1757,22 @@ framework/Web/Javascripts/ratings/stars1.png -text  framework/Web/Javascripts/rico/colors.js -text  framework/Web/Javascripts/rico/extension.js -text  framework/Web/Javascripts/rico/rico.js -text +framework/Web/Security/TAnonymousIdentificationModule.php -text +framework/Web/Security/TAuthorizationStoreRoleProvider.php -text +framework/Web/Security/TMembership.php -text +framework/Web/Security/TMembershipCreateStatus.php -text +framework/Web/Security/TMembershipCreateUserException.php -text +framework/Web/Security/TMembershipPasswordException.php -text +framework/Web/Security/TMembershipPasswordFormat.php -text +framework/Web/Security/TMembershipProvider.php -text +framework/Web/Security/TMembershipUser.php -text +framework/Web/Security/TProviderException.php -text +framework/Web/Security/TRoleManagerModule.php -text +framework/Web/Security/TRolePrincipal.php -text +framework/Web/Security/TRoleProvider.php -text +framework/Web/Security/TRoles.php -text +framework/Web/Security/TSqlRoleProvider.php -text +framework/Web/Security/TUrlAuthorizationModule.php -text  framework/Web/Services/IFeedContentProvider.php -text  framework/Web/Services/TFeedService.php -text  framework/Web/Services/TPageService.php -text diff --git a/framework/Configuration/Provider/TProviderBase.php b/framework/Configuration/Provider/TProviderBase.php new file mode 100644 index 00000000..2d44bf39 --- /dev/null +++ b/framework/Configuration/Provider/TProviderBase.php @@ -0,0 +1,54 @@ +<?php +/** + * TProviderBase class. + * Provides a base implementation for the extensible provider model. + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TProviderBase.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Configuration.Provider + * @since 3.1 + */ +abstract class TProviderBase +{ +	private $_Description; +	private $_Initialized = false; +	private $_name; + +	public function __construct(){} + +	public function getDescription() +	{ +		return $this->_Description; +	} +	public function getName() +	{ +		return $this->_name; +	} +	public function Initialize($name,$config) +	{ +		if ($this->_Initialized) +		{ +			throw new TProviderException('Provider_Already_Initialized'); +		} +		$this->_Initialized=true; + +		if ($name === null) +		{ +			throw new TProviderException('name'); +		} + +		if (strlen($name) == 0) +		{ +			throw new TProviderException('Config_provider_name_null_or_empty'); +		} + +		$this->_name = TPropertyValue::ensureString($name); + +		if ($config !== null && is_array($config)) +		{ +			$this->_Description = TPropertyValue::ensureString($config['description']); +			unset($config['description']); +		} +	} +} +?>
\ No newline at end of file diff --git a/framework/Configuration/Provider/TProviderException.php b/framework/Configuration/Provider/TProviderException.php new file mode 100644 index 00000000..ac2caf08 --- /dev/null +++ b/framework/Configuration/Provider/TProviderException.php @@ -0,0 +1,19 @@ +<?php +/** + * TProviderException class. + * The exception that is thrown when a configuration provider error has occurred.  + * This exception class is also used by providers to throw exceptions when internal  + * errors occur within the provider that do not map to other pre-existing exception classes. + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TProviderException.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Configuration.Provider + * @since 3.1 + */ + +Prado::using('System.Exceptions.TException'); +class TProviderException extends TException  +{ +	 +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TAnonymousIdentificationModule.php b/framework/Web/Security/TAnonymousIdentificationModule.php new file mode 100644 index 00000000..1735edf1 --- /dev/null +++ b/framework/Web/Security/TAnonymousIdentificationModule.php @@ -0,0 +1,7 @@ +<?php +Prado::using('System.Web.IHttpModule'); +final class TAnonymousIdentificationModule implements IHttpModule  +{ +	 +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TAuthorizationStoreRoleProvider.php b/framework/Web/Security/TAuthorizationStoreRoleProvider.php new file mode 100644 index 00000000..d6919ae6 --- /dev/null +++ b/framework/Web/Security/TAuthorizationStoreRoleProvider.php @@ -0,0 +1,68 @@ +<?php +/** + * TAuthorizationStoreRoleProvider class. + * Manages storage of role-membership information for an PRADO application in an authorization-manager policy store, in an XML file. + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TAuthorizationStoreRoleProvider.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Web.Security + * @since 3.1 + */ +Prado::using('System.Web.Security.TRoleProvider'); +class TAuthorizationStoreRoleProvider extends TRoleProvider  +{ +	private $_ApplicationName; +	public function __construct() +	{ +		 +	} +	public function getApplicationName() +	{ +		return $this->_ApplicationName; +	} +	public function setApplicationName($value) +	{ +		$this->_ApplicationName = TPropertyValue::ensureString($value); +	} +	public function AddUsersToRoles($usernames,$roleNames) +	{ +		 +	} +	public function CreateRole($roleName) +	{ +		 +	} +	public function DeleteRole($roleName) +	{ +		 +	} +	public function FineUsersInRole($roleName,$usernameToMatch) +	{ +		 +	} +	public function GetAllRoles() +	{ +		 +	} +	public function GetRolesForUser($username) +	{ +		 +	} +	public function GetUsersIsRole($username,$roleName) +	{ +		 +	} +	public function IsUserIsRole($username,$roleName) +	{ +		 +	} +	public function RemoveUsersFromRoles($usernames,$roleNames) +	{ +		 +	} +	public function RoleExists($roleName) +	{ +		 +	} +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TMembership.php b/framework/Web/Security/TMembership.php new file mode 100644 index 00000000..150f9528 --- /dev/null +++ b/framework/Web/Security/TMembership.php @@ -0,0 +1,220 @@ +<?php +/** + * TMembership class. + * Validates user credentials and manages user settings. This class cannot be inherited. + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TMembership.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Web.Security + * @since 3.1 + */ +Prado::using('System.Web.Security.'); +final class TMembership +{ +	public static $ApplicationName; +	public static $EnablePasswordReset=false; +	public static $EnablePasswordRetrieval=false; +	public static $HashAlgorithmType; +	public static $IsHashAlgorithmFromMembershipConfig=false; +	public static $MaxInvalidPasswordAttempts; +	public static $MinRequiredNonAlphanumericCharacters; +	public static $MinRequiredPasswordLength; +	public static $PasswordAttemptWindow; +	public static $PasswordStrengthReqularExpression; +	public static $Provider; +	public static $Providers; +	public static $RequiresQuestionAndAnswer=false; +	public static $UserIsOnlineTimeWindow; +	private static $_punctuations; +	private static $_s_HashAlgorithmFromConfig=false; +	private static $_s_HashAlgorithmType; +	private static $_s_Initialized=false; +	private static $_s_InitializeException; +	private static $_s_lock; +	private static $_s_Provider; +	private static $_s_Providers; +	private static $_s_UserIsOnlineTimeWindow; + +	public static function __construct() +	{ +		self::$_punctuations="!@#$%^&*()_-+=[{]};:>./?"; +		self::$_s_UserIsOnlineTimeWindow=15; +		self::$_s_lock = new stdClass(); +		self::$_s_Initialized=false; +		self::$_s_InitializeException=null; +	} +	public static function getApplicationName() +	{ +		return self::$ApplicationName; +	} +	public static function setApplicationName($value) +	{ +		self::$ApplicationName = TPropertyValue::ensureString($value); +	} +	public static function getEnablePasswordReset() +	{ +		return self::$EnablePasswordReset; +	} +	public static function getEnablePasswordRetrieval() +	{ +		return self::$EnablePasswordRetrieval; +	} +	public static function getHashAlgorithmType() +	{ +		return self::$HashAlgorithmType; +	} +	public static function getHashAlgorithmFromMembershipConfig() +	{ +		return self::$IsHashAlgorithmFromMembershipConfig; +	} +	public static function getMaxInvalidPasswordAttempts() +	{ +		return self::$MaxInvalidPasswordAttempts; +	} +	public static function getMinRequiredNonAlphanumericCharacters() +	{ +		return self::$MinRequiredNonAlphanumericCharacters; +	} +	public static function getMinRequiredPasswordLength() +	{ +		return self::$MinRequiredPasswordLength; +	} +	public static function getPasswordAttemptWindow() +	{ +		return self::$PasswordAttemptWindow; +	} +	public static function getPasswordStrengthReqularExpression() +	{ +		return self::$PasswordStrengthReqularExpression; +	} +	public static function getProvider() +	{ +		return self::$Provider; +	} +	public static function getProviders() +	{ +		return self::$Providers; +	} +	public static function getUserIsOnlineTimeWindow() +	{ +		return self::$UserIsOnlineTimeWindow; +	} +	public static function CreateUser($username,$password,$email=null,$passwordQuestion=null,$passwordAnswer=null,$isApproved=null,$providerUserKey=null) +	{ +		return self::$Provider->CreateUser($username,$password,$email,$passwordQuestion,$passwordAnswer,$isApproved,$providerUserKey); +	} +	public static function DeleteUser($username,$deleteAllRelatedData=true) +	{ +		return self::$Provider->DeleteUser($username,$deleteAllRelatedData); +	} +	public static function FindUsersByEmail($emailToMatch,$pageIndex=null,$pageSize=null) +	{ +		if ($pageIndex < 0 && $pageIndex!==null) +		{ +			throw new TException('PageIndex_bad',$pageIndex); +		} +		if ($pageSize > 1 && $pageSize!==null) +		{ +			throw new TException('PageSize_bad',$pageSize); +		} +		return self::$Provider->FindUsersByEmail($emailToMatch,$pageIndex,$pageSize); +	} +	public static function FindUsersByName($usernameToMatch,$pageIndex=null,$pageSize=null) +	{ +		if ($pageIndex < 0 && $pageIndex!==null) +		{ +			throw new TException('PageIndex_bad',$pageIndex); +		} +		if ($pageSize > 1 && $pageSize!==null) +		{ +			throw new TException('PageSize_bad',$pageSize); +		} +		return self::$Provider->FindUsersByName($usernameToMatch,$pageIndex,$pageSize); +	} +	public static function GeneratePassword($length,$numberOfNonAlphanumericCharacters) +	{ +		if (($length < 1) || ($length > 0x80)) +		{ +			throw new TException('Membership_password_length_incorrect'); +		} +		if (($numberOfNonAlphanumericCharacters > $length) || ($numberOfNonAlphanumericCharacters < 0)) +		{ +			throw new TException('Membership_min_required_non_alphanumeric_characters_incorrect',$numberOfNonAlphanumericCharacters); +		} +		//need to do the alpha checking in here +		//		$num1=0; +		//		$buffer1=null; +		//		$chArray1; +		//		$num2=0; +		//		for ($num3 = 0;$num3 < $length; $num3++) +		//		{ +		//			$num4 = $buffer[$num3]; +		//		} +	} +	public static function GetAllUsers($pageIndex=null,$pageSize=null) +	{ +		if ($pageIndex < 0 && $pageIndex!==null) +		{ +			throw new TException('PageIndex_bad',$pageIndex); +		} +		if ($pageSize > 1 && $pageSize!==null) +		{ +			throw new TException('PageSize_bad',$pageSize); +		} +		return self::$Provider->GetAllUsers($pageIndex,$pageSize); +	} +	private static function GetCurrentUserName() +	{ +		//how to get the current username? +	} +	public static function GetNumberOfUsersOnline() +	{ +		return self::$Provider->GetNumberOfUsersOnline(); +	} +	public static function GetUser($username=null,$providerUserKey=null,$userIsOnline=false) +	{ +		if ($username===null && $providerUserKey===null) +		{ +			return self::$Provider->GetUser(self::GetCurrentUserName(),null,true); +		} +		if ($username===null && $providerUserKey!==null) +		{ +			return self::$Provider->GetUser(null,$providerUserKey,$userIsOnline); +		} +		if ($username!==null && $providerUserKey===null) +		{ +			return self::$Provider->GetUser($username,null,$userIsOnline); +		} +	} +	public static function GetUserNameByEmail($emailToMatch) +	{ +		return self::$Provider->GetUserNameByEmail($emailToMatch); +	} +	private static function Initialize() +	{ +		if (self::$_s_Initialized) +		{ +			if (self::$_s_InitializeException!==null) +			{ +				throw new self::$_s_InitializeException; +			} +		} +		else +		{ + +		} +	} +	public static function UpdateUser(TMembershipUser $user) +	{ +		if ($user===null) +		{ +			throw new TException('Membership_user_can_not_be_null'); +		} +		$user->Update(); +	} +	public static function ValidateUser($username,$password) +	{ +		return self::$Provider->ValidateUser($username,$password); +	} +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TMembershipCreateStatus.php b/framework/Web/Security/TMembershipCreateStatus.php new file mode 100644 index 00000000..78b64de4 --- /dev/null +++ b/framework/Web/Security/TMembershipCreateStatus.php @@ -0,0 +1,39 @@ +<?php +/** + * TMembershipCreateStatus class. + * Describes the result of a CreateUser operation. + *  + * DuplicateEmail			The e-mail address already exists in the database for the application.  + * DuplicateProviderUserKey	The provider user key already exists in the database for the application.  + * DuplicateUserName		The user name already exists in the database for the application.  + * InvalidAnswer			The password answer is not formatted correctly.  + * InvalidEmail				The e-mail address is not formatted correctly.  + * InvalidPassword			The password is not formatted correctly.  + * InvalidProviderUserKey	The provider user key is of an invalid type or format.  + * InvalidQuestion			The password question is not formatted correctly.  + * InvalidUserName			The user name was not found in the database.  + * ProviderError			The provider returned an error that is not described by other MembershipCreateStatus enumeration values.  + * Success					The user was successfully created.  + * UserRejected				The user was not created, for a reason defined by the provider.  + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TMembershipCreateStatus.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Web.Security + * @since 3.1 + */ +class TMembershipCreateStatus extends TEnumerable  +{ +	const DuplicateEmail='DuplicateEmail'; +	const DuplicateProviderUserKey='DuplicateProviderUserKey'; +	const DuplicateUserName='DuplicateUserName'; +	const InvalidAnswer='InvalidAnswer'; +	const InvalidEmail='InvalidEmail'; +	const InvalidPassword='InvalidPassword'; +	const InvalidProviderUserKey='InvalidProviderUserKey'; +	const InvalidQuestion='InvalidQuestion'; +	const InvalidUserName='InvalidUserName'; +	const ProviderError='ProviderError'; +	const Success='Success'; +	const UserRejected='UserRejected'; +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TMembershipCreateUserException.php b/framework/Web/Security/TMembershipCreateUserException.php new file mode 100644 index 00000000..def74c8d --- /dev/null +++ b/framework/Web/Security/TMembershipCreateUserException.php @@ -0,0 +1,17 @@ +<?php +/** + * TMembershipCreateUserException class. + * The exception that is thrown when a user is not successfully created by a membership provider. + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TMembershipCreateUserException.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Configuration.Provider + * @since 3.1 + */ + +Prado::using('System.Exceptions.TException'); +class TMembershipCreateUserException extends TException  +{ +	 +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TMembershipPasswordException.php b/framework/Web/Security/TMembershipPasswordException.php new file mode 100644 index 00000000..faf0c599 --- /dev/null +++ b/framework/Web/Security/TMembershipPasswordException.php @@ -0,0 +1,17 @@ +<?php +/** + * TMembershipPasswordException class. + * The exception that is thrown when a user is not successfully created by a membership provider. + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TMembershipPasswordException.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Configuration.Provider + * @since 3.1 + */ + +Prado::using('System.Exceptions.TException'); +class TMembershipPasswordException extends TException  +{ +	 +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TMembershipPasswordFormat.php b/framework/Web/Security/TMembershipPasswordFormat.php new file mode 100644 index 00000000..6648c92b --- /dev/null +++ b/framework/Web/Security/TMembershipPasswordFormat.php @@ -0,0 +1,24 @@ +<?php +/** + * TMembershipPasswordFormat class. + * Describes the encryption format for storing passwords for membership users. + *  + * Clear		Passwords are not encrypted.  + * Encrypted	Passwords are encrypted using the encryption settings determined by the  + * 				machineKey Element (ASP.NET Settings Schema) element configuration.  + * Hashed		Passwords are encrypted one-way using the SHA1 hashing algorithm.  + * 				You can specify a hashing algorithm different than the SHA1  + * 				algorithm using the hashAlgorithmType attribute. + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TMembershipPasswordFormat.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Web.Security + * @since 3.1 + */ +class TMembershipPasswordFormat extends TEnumerable  +{ +	const Clear='Clear'; +	const Encrypted='Encrypted'; +	const Hashed='Hashed'; +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TMembershipProvider.php b/framework/Web/Security/TMembershipProvider.php new file mode 100644 index 00000000..674f338c --- /dev/null +++ b/framework/Web/Security/TMembershipProvider.php @@ -0,0 +1,66 @@ +<?php +/** + * TMembershipProvider class. + * Defines the contract that PRADO implements to provide membership services using custom membership providers. + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TMembershipProvider.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Web.Security + * @since 3.1 + */ +Prado::using('System.Configuration.Provider.TProviderBase'); +abstract class TMembershipProvider extends TProviderBase +{ +	public abstract $ApplicationName; +	public abstract $EnablePasswordReset=false; +	public abstract $EnablePasswordRetrieval=false; +	public abstract $MaxInvalidPasswordAttempts; +	public abstract $MinRequiredNonAlphanumericCharacters; +	public abstract $MinRequiredPasswordLength; +	public abstract $PasswordAttemptWindow; +	public abstract $PasswordStrengthReqularExpression; +	public abstract $RequiresQuestionAndAnswer=false; +	public abstract $RequiresUniqueEmail=false; +	//	private const SALT_SIZE_IN_BYTES = 0x10; +	 +	protected function __construct() +	{ +		 +	} +	public abstract function ChangePassword($username,$oldPassword,$newPassword); +	public abstract function ChangePasswordQuestionAndAnswer($username,$password,$newPasswordQuestion,$newPasswordAnswer); +	public abstract function CreateUser($username,$password,$email,$passwordQuestion,$passwordAnswer,$isApproved,$providerUserKey); +	protected function DecryptPassword($encodedPassword) +	{ +		 +	} +	public abstract function DeleteUser($username,$deleteAllRelatedData); +	public function EncodePassword($pass,$passwordFormat,$salt) +	{ +		 +	} +	protected function EncryptPassword($password) +	{ +		 +	} +	public abstract function FindUsersByEmail($emailToMatch,$pageIndex=null,$pageSize=null); +	public abstract function FindUsersByName($usernameToMatch,$pageIndex=null,$pageSize=null); +	public function GenerateSalt() +	{ +		 +	} +	public abstract function GetAllUsers($pageIndex=null,$pageSize=null); +	public abstract function GetNumberOfUsersOnline(); +	public abstract function GetPassword($username,$answer); +	public abstract function GetUser($username=null,$providerUserKey=null,$userIsOnline); +	public abstract function GetUserNameByEmail($email); +	public abstract function ResetPassword($username,$answer); +	public function UnEncodePassword($pass,$passwordFormat) +	{ +		 +	} +	public abstract function UnlockUser($userName); +	public abstract function UpdateUser(TMembershipUser $user); +	public abstract function ValidateUser($username,$password); +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TMembershipUser.php b/framework/Web/Security/TMembershipUser.php new file mode 100644 index 00000000..722459fc --- /dev/null +++ b/framework/Web/Security/TMembershipUser.php @@ -0,0 +1,180 @@ +<?php +/** + * TMembershipUser class. + * Exposes and updates membership user information in the membership data store. + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TMembershipUser.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Web.Security + * @since 3.1 + */ +class TMembershipUser +{ +	public $Comment; +	public $CreationDate; +	public $Email; +	public $IsApproved=false; +	public $IsLockedOut=false; +	public $IsOnline=false; +	public $LastActivityDate; +	public $LastLockoutDate; +	public $LastLoginDate; +	public $LastPasswordChangedDate; +	public $PasswordQuestion; +	public $ProviderName; +	public $ProviderUserKey; +	public $UserName; +	private $_Comment; +	private $_CreationDate; +	private $_Email; +	private $_IsApproved=false; +	private $_IsLockedOut=false; +	private $_LastActivityDate; +	private $_LastLockoutDate; +	private $_LastLoginDate; +	private $_LastPasswordChangedDate; +	private $_PasswordQuestion; +	private $_ProviderName; +	private $_ProviderUserKey; +	private $_UserName; + +	public function __construct($providerName=null,$name=null,$providerUserKey=null,$email=null,$passwordQuestion=null,$comment=null,$isApproved=null,$isLockedOut=null,$creationDate=null,$lastLoginDate=null,$lastActivityDate=null,$lastPasswordChangedDate=null,$lastLockoutDate=null) +	{ +		if (($providerName===null) || (TMembership===null)) +		{ +			throw new TProviderException('Membership_provider_name_invalid',$providerName); +		} +		if ($name!==null) +		{ +			$name = trim($name); +		} +		if ($email!==null) +		{ +			$email = trim($email); +		} +		if ($passwordQuestion!==null) +		{ +			$passwordQuestion = trim($passwordQuestion); +		} +		$this->_ProviderName = $providerName; +		$this->_UserName = $name; +		$this->_ProviderUserKey = $providerUserKey; +		$this->_Email = $email; +		$this->_PasswordQuestion = $passwordQuestion; +		$this->_Comment = $comment; +		$this->_IsApproved = $isApproved; +		$this->_IsLockedOut = $isLockedOut; +		$this->_CreationDate = $creationDate; +		$this->_LastLoginDate = $lastLoginDate; +		$this->_LastActivityDate = $lastActivityDate; +		$this->_LastPasswordChangedDate = $lastPasswordChangedDate; +		$this->_LastLockoutDate = $lastLockoutDate; +	} +	public function getComment() +	{ +		return $this->Comment; +	} +	public function setApplicationName($value) +	{ +		$this->Comment = TPropertyValue::ensureString($value); +	} +	public function getCreationDate() +	{ +		return $this->CreationDate; +	} +	public function getEmail() +	{ +		return $this->Email; +	} +	public function setEmail($value) +	{ +		$this->Email = TPropertyValue::ensureString($value); +	} +	public function getIsApproved() +	{ +		return $this->IsApproved; +	} +	public function setIsApproved($value) +	{ +		$this->IsApproved = TPropertyValue::ensureBoolean($value); +	} +	public function getIsLockedOut() +	{ +		return $this->IsLockedOut; +	} +	public function getIsOnline() +	{ +		return $this->IsOnline; +	} +	public function getLastActivityDate() +	{ +		return $this->LastActivityDate; +	} +	public function setLastActivityDate($value) +	{ +		$this->LastActivityDate = TPropertyValue::ensureString($value); +	} +	public function getLastLockoutDate() +	{ +		return $this->LastLockoutDate; +	} +	public function getLastLoginDate() +	{ +		return $this->LastLoginDate; +	} +	public function setLastLoginDate($value) +	{ +		$this->LastLoginDate = TPropertyValue::ensureString($value); +	} +	public function getLastPasswordChangedDate() +	{ +		return $this->LastPasswordChangedDate; +	} +	public function getLastPasswordChangedDate() +	{ +		return $this->LastPasswordChangedDate; +	} +	public function getPasswordQuestion() +	{ +		return $this->PasswordQuestion; +	} +	public function getProviderUserKey() +	{ +		return $this->ProviderUserKey; +	} +	public function getUserName() +	{ +		return $this->UserName; +	} +	public function ChangePassword($oldPassword,$newPassword,$throwOnError=null) +	{ + +	} +	public function GetPassword() +	{ +		//		$throwOnError; +		//		$passwordAnswer; +		//		$answer; +		//		$answer,$useAnswer,$throwOnError; +	} +	public function ResetPassword() +	{ +		//		$throwOnError; +		//		$passwordAnswer; +		//		$answer; +		//		$answer,$useAnswer,$throwOnError; +	} + 	public function UnlockUser() + 	{ + 		 + 	} + 	public function Update() + 	{ + 		 + 	} + 	private function UpdateSelf() + 	{ + 		 + 	} +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TProviderException.php b/framework/Web/Security/TProviderException.php new file mode 100644 index 00000000..7239585c --- /dev/null +++ b/framework/Web/Security/TProviderException.php @@ -0,0 +1,6 @@ +<?php +class TProviderException extends TException  +{ +	 +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TRoleManagerModule.php b/framework/Web/Security/TRoleManagerModule.php new file mode 100644 index 00000000..7f6181e0 --- /dev/null +++ b/framework/Web/Security/TRoleManagerModule.php @@ -0,0 +1,6 @@ +<?php +class TRoleManagerModule +{ +	 +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TRolePrincipal.php b/framework/Web/Security/TRolePrincipal.php new file mode 100644 index 00000000..682f2cbe --- /dev/null +++ b/framework/Web/Security/TRolePrincipal.php @@ -0,0 +1,6 @@ +<?php +final class TRolePrincipal +{ +	 +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TRoleProvider.php b/framework/Web/Security/TRoleProvider.php new file mode 100644 index 00000000..d705be7e --- /dev/null +++ b/framework/Web/Security/TRoleProvider.php @@ -0,0 +1,32 @@ +<?php +/** + * TRoleProvider class. + * Defines the contract that PRADO implements to provide role-management services using custom role providers.  + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TRoleProvider.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Web.Security + * @since 3.1 + */ +Prado::using('System.Configuration.Provider.TProviderBase'); +abstract class TRoleProvider extends TProviderBase  +{ +	private abstract $_ApplicationName; +	protected function __construct() +	{ +		 +	} +	public abstract function getApplicationName(); +	public abstract function setApplicationName($value); +	public abstract function AddUsersToRoles($usernames,$roleNames); +	public abstract function CreateRole($roleName); +	public abstract function DeleteRole($roleName); +	public abstract function FineUsersInRole($roleName,$usernameToMatch); +	public abstract function GetAllRoles(); +	public abstract function GetRolesForUser($username); +	public abstract function GetUsersIsRole($username,$roleName); +	public abstract function IsUserIsRole($username,$roleName); +	public abstract function RemoveUsersFromRoles($usernames,$roleNames); +	public abstract function RoleExists($roleName); +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TRoles.php b/framework/Web/Security/TRoles.php new file mode 100644 index 00000000..45e112c7 --- /dev/null +++ b/framework/Web/Security/TRoles.php @@ -0,0 +1,228 @@ +<?php +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 $_s_EnabledSet=false; +	private static $_s_Initialized=false; +	private static $_s_InitializeException; +	private static $_s_lock; + +	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::$_s_Initialized) +		{ +			throw new TException('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::$_s_Initialized) +		{ +			if (self::$_s_InitializeException!==null) +			{ +				throw new $_s_InitializeException; +			} +		} +		else +		{ +			if (self::$_s_Initialized) +			{ +				if (self::$_s_InitializeException!==null) +				{ +					throw new $_s_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 TException('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) +	{ + +	} +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TSqlRoleProvider.php b/framework/Web/Security/TSqlRoleProvider.php new file mode 100644 index 00000000..24f5e38d --- /dev/null +++ b/framework/Web/Security/TSqlRoleProvider.php @@ -0,0 +1,41 @@ +<?php +/** + * TSqlRoleProvider class. + * Defines the contract that PRADO implements to provide role-management services using custom role providers.  + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TSqlRoleProvider.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Web.Security + * @since 3.1 + */ +Prado::using('System.Web.Security.TRoleProvider'); +class TSqlRoleProvider extends TRoleProvider  +{ +	private $_ApplicationName; +	protected function __construct() +	{ +		 +	} +	public function getApplicationName() +	{ +		return $this->_ApplicationName; +	} +	public function setApplicationName($value) +	{ +		$this->_ApplicationName = TPropertyValue::ensureString($value); +	} +	public function AddUsersToRoles($usernames,$roleNames) +	{ +		 +	} +	public function CreateRole($roleName); +	public function DeleteRole($roleName); +	public function FineUsersInRole($roleName,$usernameToMatch); +	public function GetAllRoles(); +	public function GetRolesForUser($username); +	public function GetUsersIsRole($username,$roleName); +	public function IsUserIsRole($username,$roleName); +	public function RemoveUsersFromRoles($usernames,$roleNames); +	public function RoleExists($roleName); +} +?>
\ No newline at end of file diff --git a/framework/Web/Security/TUrlAuthorizationModule.php b/framework/Web/Security/TUrlAuthorizationModule.php new file mode 100644 index 00000000..c321d95d --- /dev/null +++ b/framework/Web/Security/TUrlAuthorizationModule.php @@ -0,0 +1,6 @@ +<?php +final class TUrlAuthorizationModule +{ +	 +} +?>
\ No newline at end of file | 
