summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjrags <>2006-09-21 00:57:53 +0000
committerjrags <>2006-09-21 00:57:53 +0000
commitb6e12bedc51b56cf0f1a5930e69a4c377cd3dfe5 (patch)
tree15931a9902b97d31fb4a4788634c222587c52632
parent5da182335ceec1c8ad68047217a33375897f1c1d (diff)
Added providers demo, sqlmembershipprovider sqlroleprovider both load via modules now, but are not totaly functional yet. TLogin* controls created but not functional yet.
-rw-r--r--.gitattributes7
-rw-r--r--demos/providers/index.php20
-rw-r--r--demos/providers/protected/.htaccess1
-rw-r--r--demos/providers/protected/application.xml43
-rw-r--r--demos/providers/protected/pages/Home.page4
-rw-r--r--demos/providers/protected/pages/Home.php27
-rw-r--r--framework/Configuration/Provider/TProviderBase.php80
-rw-r--r--framework/Configuration/TProtectedConfiguration.php84
-rw-r--r--framework/Web/Security/TMembership.php122
-rw-r--r--framework/Web/Security/TMembershipProvider.php187
-rw-r--r--framework/Web/Security/TMembershipUser.php123
-rw-r--r--framework/Web/Security/TRoleProvider.php82
-rw-r--r--framework/Web/Security/TRoles.php159
-rw-r--r--framework/Web/Security/TSqlMembershipProvider.php83
-rw-r--r--framework/Web/Security/TSqlRoleProvider.php61
15 files changed, 800 insertions, 283 deletions
diff --git a/.gitattributes b/.gitattributes
index dae1c30f..f40827f9 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -698,6 +698,11 @@ demos/personal/protected/application.xml -text
demos/personal/themes/BlueTheme/buttons.skin -text
demos/personal/themes/BlueTheme/icon_profile.gif -text
demos/personal/themes/BlueTheme/labels.skin -text
+demos/providers/index.php -text
+demos/providers/protected/.htaccess -text
+demos/providers/protected/application.xml -text
+demos/providers/protected/pages/Home.page -text
+demos/providers/protected/pages/Home.php -text
demos/quickstart/images/star1.gif -text
demos/quickstart/images/star2.gif -text
demos/quickstart/images/star3.gif -text
@@ -1296,6 +1301,7 @@ framework/Collections/TQueue.php -text
framework/Collections/TStack.php -text
framework/Configuration/Provider/TProviderBase.php -text
framework/Configuration/Provider/TProviderException.php -text
+framework/Configuration/TProtectedConfiguration.php -text
framework/DataAccess/SQLMap/Configuration/TConfigDeserialize.php -text
framework/DataAccess/SQLMap/Configuration/TDiscriminator.php -text
framework/DataAccess/SQLMap/Configuration/TDomSqlMapBuilder.php -text
@@ -1771,6 +1777,7 @@ 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/TSqlMembershipProvider.php -text
framework/Web/Security/TSqlRoleProvider.php -text
framework/Web/Security/TUrlAuthorizationModule.php -text
framework/Web/Services/IFeedContentProvider.php -text
diff --git a/demos/providers/index.php b/demos/providers/index.php
new file mode 100644
index 00000000..50bfe940
--- /dev/null
+++ b/demos/providers/index.php
@@ -0,0 +1,20 @@
+<?php
+
+$basePath=dirname(__FILE__);
+$frameworkPath='/Users/jrags/Sites/prado-trunk/framework/prado.php';
+$assetsPath=$basePath."/assets";
+$runtimePath=$basePath."/protected/runtime";
+
+if(!is_file($frameworkPath))
+ die("Unable to find prado framework path $frameworkPath.");
+if(!is_writable($assetsPath))
+ die("Please make sure that the directory $assetsPath is writable by Web server process.");
+if(!is_writable($runtimePath))
+ die("Please make sure that the directory $runtimePath is writable by Web server process.");
+
+require_once($frameworkPath);
+
+$application=new TApplication;
+$application->run();
+
+?> \ No newline at end of file
diff --git a/demos/providers/protected/.htaccess b/demos/providers/protected/.htaccess
new file mode 100644
index 00000000..3418e55a
--- /dev/null
+++ b/demos/providers/protected/.htaccess
@@ -0,0 +1 @@
+deny from all \ No newline at end of file
diff --git a/demos/providers/protected/application.xml b/demos/providers/protected/application.xml
new file mode 100644
index 00000000..d9258934
--- /dev/null
+++ b/demos/providers/protected/application.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<application id="Providers" mode="Debug">
+
+ <modules>
+ <module id="MembershipProvider"
+ class="System.Configuration.TProtectedConfiguration"
+ defaultProvider="SqlMembershipProvider" >
+ <provider
+ id="SqlMembershipProvider"
+ Description="Our SQL Membership provider"
+ class="System.Web.Security.TSqlMembershipProvider"
+ ConnectionStringName="SqlMembershipProvider"
+ Enabled="true"
+ EnablePasswordReset="True"
+ EnablePasswordRetrieval="True"
+ MaxInvalidPasswordAttempts="5"
+ MinRequiredNonAlphanumericCharacters="5"
+ MinRequiredPasswordLength="5"
+ PasswordAttemptWindow="5"
+ PasswordStrengthRegularExpression=""
+ RequiresQuestionAndAnswer="True"
+ RequiresUniqueEmail="True"/>
+ </module>
+
+ <module id="RoleProvider"
+ class="System.Configuration.TProtectedConfiguration"
+ defaultProvider="SqlRoleProvider">
+ <provider
+ id="SqlRoleProvider"
+ class="System.Web.Security.TSqlRoleProvider"
+ ConnectionStringName="SqlRoleProvider"
+ ApplicationName="SampleApplication"
+ Enabled="true"
+ CacheRolesInCookie="True"
+ CookieName="PRADO"
+ CookieTimeout="30"
+ CookiePath="/"
+ CookieRequireSSL="False"
+ CookieSlidingExpiration="True"/>
+ </module>
+ </modules>
+</application> \ No newline at end of file
diff --git a/demos/providers/protected/pages/Home.page b/demos/providers/protected/pages/Home.page
new file mode 100644
index 00000000..10069478
--- /dev/null
+++ b/demos/providers/protected/pages/Home.page
@@ -0,0 +1,4 @@
+<h1>Welcome to Prado!</h1>
+<com:TForm>
+ <com:TLogin ID="LoginCtrl" MembershipProvider="SqlMembershipProvider"/>
+</com:TForm> \ No newline at end of file
diff --git a/demos/providers/protected/pages/Home.php b/demos/providers/protected/pages/Home.php
new file mode 100644
index 00000000..bbcbc20b
--- /dev/null
+++ b/demos/providers/protected/pages/Home.php
@@ -0,0 +1,27 @@
+<?php
+class Home extends TPage
+{
+ public function OnLoad($param)
+ {
+ Prado::using('System.Util.TVarDumper');
+ Prado::using('System.Web.Security.TSqlMembershipProvider');
+ Prado::using('System.Configuration.TProtectedConfiguration');
+ // TRoles::CreateRole('test');
+ // TMembership::ValidateUser('test','test');
+ // echo TVarDumper::dump(TProtectedConfiguration::getDefaultProvider(),10,true);
+ // echo TVarDumper::dump($this->Application->getModule('ProtectedConfiguration'),10,true);
+
+
+ // Access by provider id
+ // $MembershipProvider = $this->Application->getModule('MembershipProvider')->getProvider('SqlMembershipProvider');
+ // or just get the default provider
+ $MembershipProvider = $this->Application->getModule('MembershipProvider')->Provider;
+ // $RoleProvider = $this->Application->getModule('RoleProvider')->Provider;
+ /* @VAR $MembershipProvider TSqlMembershipProvider */
+ /* @VAR $RoleProvider TSqlRoleProvider */
+ echo TVarDumper::dump($MembershipProvider,10,true);
+ echo TVarDumper::dump($MembershipProvider->getMembershipUser('testUser'),10,true);
+ // echo TVarDumper::dump($RoleProvider,10,true);
+ }
+}
+?> \ No newline at end of file
diff --git a/framework/Configuration/Provider/TProviderBase.php b/framework/Configuration/Provider/TProviderBase.php
index 2d44bf39..7c5ffbb8 100644
--- a/framework/Configuration/Provider/TProviderBase.php
+++ b/framework/Configuration/Provider/TProviderBase.php
@@ -8,29 +8,51 @@
* @package System.Configuration.Provider
* @since 3.1
*/
-abstract class TProviderBase
+abstract class TProviderBase extends TModule
{
- private $_Description;
- private $_Initialized = false;
+ private $_description;
+ private $_initialized = false;
private $_name;
+ private $_applicationName;
+ private $_enabled=false;
public function __construct(){}
public function getDescription()
{
- return $this->_Description;
+ return $this->_description;
+ }
+ public function setDescription($value)
+ {
+ $this->_description = TPropertyValue::ensureString($value);
}
public function getName()
{
return $this->_name;
}
- public function Initialize($name,$config)
+ public function getApplicationName()
+ {
+ return $this->_applicationName;
+ }
+ public function setApplicationName($value)
+ {
+ $this->_applicationName = TPropertyValue::ensureString($value);
+ }
+ public function getEnabled()
{
- if ($this->_Initialized)
+ return $this->_enabled;
+ }
+ public function setEnabled($value)
+ {
+ $this->_enabled = TPropertyValue::ensureBoolean($value);
+ }
+ public function initialize($name,$config)
+ {
+ if ($this->_initialized)
{
throw new TProviderException('Provider_Already_Initialized');
}
- $this->_Initialized=true;
+ $this->_initialized=true;
if ($name === null)
{
@@ -46,9 +68,51 @@ abstract class TProviderBase
if ($config !== null && is_array($config))
{
- $this->_Description = TPropertyValue::ensureString($config['description']);
+ $this->_description = TPropertyValue::ensureString($config['description']);
unset($config['description']);
}
}
+ /**
+ * Generates a Universally Unique IDentifier, version 4.
+ *
+ * RFC 4122 (http://www.ietf.org/rfc/rfc4122.txt) defines a special type of Globally
+ * Unique IDentifiers (GUID), as well as several methods for producing them. One
+ * such method, described in section 4.4, is based on truly random or pseudo-random
+ * number generators, and is therefore implementable in a language like PHP.
+ *
+ * We choose to produce pseudo-random numbers with the Mersenne Twister, and to always
+ * limit single generated numbers to 16 bits (ie. the decimal value 65535). That is
+ * because, even on 32-bit systems, PHP's RAND_MAX will often be the maximum *signed*
+ * value, with only the equivalent of 31 significant bits. Producing two 16-bit random
+ * numbers to make up a 32-bit one is less efficient, but guarantees that all 32 bits
+ * are random.
+ *
+ * The algorithm for version 4 UUIDs (ie. those based on random number generators)
+ * states that all 128 bits separated into the various fields (32 bits, 16 bits, 16 bits,
+ * 8 bits and 8 bits, 48 bits) should be random, except : (a) the version number should
+ * be the last 4 bits in the 3rd field, and (b) bits 6 and 7 of the 4th field should
+ * be 01. We try to conform to that definition as efficiently as possible, generating
+ * smaller values where possible, and minimizing the number of base conversions.
+ *
+ * @copyright Copyright (c) CFD Labs, 2006. This function may be used freely for
+ * any purpose ; it is distributed without any form of warranty whatsoever.
+ * @author David Holmes <dholmes@cfdsoftware.net>
+ *
+ * @return string A UUID, made up of 32 hex digits and 4 hyphens.
+ */
+ public function generateUuid()
+ {
+ // The field names refer to RFC 4122 section 4.1.2
+ return sprintf('%04x%04x-%04x-%03x4-%04x-%04x%04x%04x',
+ mt_rand(0, 65535), mt_rand(0, 65535), // 32 bits for "time_low"
+ mt_rand(0, 65535), // 16 bits for "time_mid"
+ mt_rand(0, 4095), // 12 bits before the 0100 of (version) 4 for "time_hi_and_version"
+ bindec(substr_replace(sprintf('%016b', mt_rand(0, 65535)), '01', 6, 2)),
+ // 8 bits, the last two of which (positions 6 and 7) are 01, for "clk_seq_hi_res"
+ // (hence, the 2nd hex digit after the 3rd hyphen can only be 1, 5, 9 or d)
+ // 8 bits for "clk_seq_low"
+ mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535) // 48 bits for "node"
+ );
+ }
}
?> \ No newline at end of file
diff --git a/framework/Configuration/TProtectedConfiguration.php b/framework/Configuration/TProtectedConfiguration.php
new file mode 100644
index 00000000..da643014
--- /dev/null
+++ b/framework/Configuration/TProtectedConfiguration.php
@@ -0,0 +1,84 @@
+<?php
+/**
+ * TProtectedConfiguration class.
+ * Provides access to the protected-configuration providers for the current application's configuration file.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TProtectedConfiguration.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Configuration
+ * @since 3.1
+ */
+final class TProtectedConfiguration extends TModule
+{
+ private $_defaultProvider;
+ /**
+ * @var array list of providers available
+ */
+ private $_providers=array();
+ /**
+ * @var string external configuration file
+ */
+ private $_configFile=null;
+
+ public function getDefaultProvider()
+ {
+ return $this->_defaultProvider;
+ }
+ public function setDefaultProvider($value)
+ {
+ $this->_defaultProvider = TPropertyValue::ensureString($value);
+ }
+ public function getProvider($value=null)
+ {
+ if ($value)
+ $index = $value;
+ else
+ $index = $this->_defaultProvider;
+
+ $provider = $this->_providers[$index];
+
+ if (!$provider instanceof TProviderBase)
+ throw new TConfigurationException('protectedconfiguration_not_a_provider',$index);
+
+ return $provider;
+ }
+
+ public function init($config)
+ {
+ if($this->_configFile!==null)
+ {
+ if(is_file($this->_configFile))
+ {
+ $dom=new TXmlDocument;
+ $dom->loadFromFile($this->_configFile);
+ $this->loadConfig($dom);
+ }
+ else
+ throw new TConfigurationException('protectedconfiguration_configfile_invalid',$this->_configFile);
+ }
+ $this->loadConfig($config);
+// $this->getApplication()->attachEventHandler('OnEndRequest',array($this,'collectLogs'));
+ }
+ /**
+ * Loads configuration from an XML element
+ * @param TXmlElement configuration node
+ * @throws TConfigurationException if log route class or type is not specified
+ */
+ private function loadConfig($xml)
+ {
+ foreach($xml->getElementsByTagName('provider') as $providerConfig)
+ {
+ $properties=$providerConfig->getAttributes();
+ if(($class=$properties->remove('class'))===null)
+ throw new TConfigurationException('protectedconfiguration_providerclass_required');
+ $provider=Prado::createComponent($class);
+ if(!($provider instanceof TProviderBase))
+ throw new TConfigurationException('protectedconfiguration_providertype_invalid');
+ foreach($properties as $name=>$value)
+ $provider->setSubproperty($name,$value);
+ $this->_providers[$provider->getId()]=$provider;
+ $provider->init($providerConfig);
+ }
+ }
+}
+?> \ No newline at end of file
diff --git a/framework/Web/Security/TMembership.php b/framework/Web/Security/TMembership.php
index 2909eb8b..e68a0a6a 100644
--- a/framework/Web/Security/TMembership.php
+++ b/framework/Web/Security/TMembership.php
@@ -10,90 +10,92 @@
*/
final class TMembership
{
- private static $_ApplicationName;
- private static $_EnablePasswordReset=false;
- private static $_EnablePasswordRetrieval=false;
- private static $_HashAlgorithmType;
- private static $_IsHashAlgorithmFromMembershipConfig=false;
- private static $_MaxInvalidPasswordAttempts;
- private static $_MinRequiredNonAlphanumericCharacters;
- private static $_MinRequiredPasswordLength;
- private static $_PasswordAttemptWindow;
- private static $_PasswordStrengthReqularExpression;
- private static $_Provider;
- private static $_Providers;
- private static $_RequiresQuestionAndAnswer=false;
- private static $_UserIsOnlineTimeWindow=15;
+ private static $_applicationName;
+ private static $_enablePasswordReset=false;
+ private static $_enablePasswordRetrieval=false;
+ private static $_hashAlgorithmType;
+ private static $_isHashAlgorithmFromMembershipConfig=false;
+ private static $_maxInvalidPasswordAttempts;
+ private static $_minRequiredNonAlphanumericCharacters;
+ private static $_minRequiredPasswordLength;
+ private static $_passwordAttemptWindow;
+ private static $_passwordStrengthReqularExpression;
+ private static $_provider;
+ private static $_providers;
+ private static $_requiresQuestionAndAnswer=false;
+ private static $_userIsOnlineTimeWindow=15;
private static $_punctuations='!@#$%^&*()_-+=[{]};:>./?';
- private static $_HashAlgorithmFromConfig=false;
- private static $_Initialized=false;
- private static $_InitializeException;
+ private static $_hashAlgorithmFromConfig=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 getEnablePasswordReset()
{
- return self::$_EnablePasswordReset;
+ return self::$_enablePasswordReset;
}
public static function getEnablePasswordRetrieval()
{
- return self::$_EnablePasswordRetrieval;
+ return self::$_enablePasswordRetrieval;
}
public static function getHashAlgorithmType()
{
- return self::$_HashAlgorithmType;
+ return self::$_hashAlgorithmType;
}
public static function getHashAlgorithmFromMembershipConfig()
{
- return self::$_IsHashAlgorithmFromMembershipConfig;
+ return self::$_isHashAlgorithmFromMembershipConfig;
}
public static function getMaxInvalidPasswordAttempts()
{
- return self::$_MaxInvalidPasswordAttempts;
+ return self::$_maxInvalidPasswordAttempts;
}
public static function getMinRequiredNonAlphanumericCharacters()
{
- return self::$_MinRequiredNonAlphanumericCharacters;
+ return self::$_minRequiredNonAlphanumericCharacters;
}
public static function getMinRequiredPasswordLength()
{
- return self::$_MinRequiredPasswordLength;
+ return self::$_minRequiredPasswordLength;
}
public static function getPasswordAttemptWindow()
{
- return self::$_PasswordAttemptWindow;
+ return self::$_passwordAttemptWindow;
}
public static function getPasswordStrengthReqularExpression()
{
- return self::$_PasswordStrengthReqularExpression;
+ return self::$_passwordStrengthReqularExpression;
}
public static function getProvider()
{
- return self::$_Provider;
+ self::initialize();
+ return self::$_provider;
}
- public static function getProviders()
+ public static function getProviders($providerName)
{
- return self::$_Providers;
+ self::initialize();
+ return self::$_providers[$providerName];
}
public static function getUserIsOnlineTimeWindow()
{
- return self::$_UserIsOnlineTimeWindow;
+ return self::$_userIsOnlineTimeWindow;
}
- public static function CreateUser($username,$password,$email=null,$passwordQuestion=null,$passwordAnswer=null,$isApproved=null,$providerUserKey=null)
+ 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);
+ return self::$_provider->createUser($username,$password,$email,$passwordQuestion,$passwordAnswer,$isApproved,$providerUserKey);
}
- public static function DeleteUser($username,$deleteAllRelatedData=true)
+ public static function deleteUser($username,$deleteAllRelatedData=true)
{
- return self::$_Provider->DeleteUser($username,$deleteAllRelatedData);
+ return self::$_provider->deleteUser($username,$deleteAllRelatedData);
}
- public static function FindUsersByEmail($emailToMatch,$pageIndex=null,$pageSize=null)
+ public static function findUsersByEmail($emailToMatch,$pageIndex=null,$pageSize=null)
{
if ($pageIndex < 0 && $pageIndex!==null)
{
@@ -103,9 +105,9 @@ final class TMembership
{
throw new TException('PageSize_bad',$pageSize);
}
- return self::$_Provider->FindUsersByEmail($emailToMatch,$pageIndex,$pageSize);
+ return self::$_provider->findUsersByEmail($emailToMatch,$pageIndex,$pageSize);
}
- public static function FindUsersByName($usernameToMatch,$pageIndex=null,$pageSize=null)
+ public static function findUsersByName($usernameToMatch,$pageIndex=null,$pageSize=null)
{
if ($pageIndex < 0 && $pageIndex!==null)
{
@@ -115,9 +117,9 @@ final class TMembership
{
throw new TException('PageSize_bad',$pageSize);
}
- return self::$_Provider->FindUsersByName($usernameToMatch,$pageIndex,$pageSize);
+ return self::$_provider->findUsersByName($usernameToMatch,$pageIndex,$pageSize);
}
- public static function GeneratePassword($length,$numberOfNonAlphanumericCharacters)
+ public static function generatePassword($length,$numberOfNonAlphanumericCharacters)
{
if (($length < 1) || ($length > 0x80))
{
@@ -137,7 +139,7 @@ final class TMembership
// $num4 = $buffer[$num3];
// }
}
- public static function GetAllUsers($pageIndex=null,$pageSize=null)
+ public static function getAllUsers($pageIndex=null,$pageSize=null)
{
if ($pageIndex < 0 && $pageIndex!==null)
{
@@ -147,42 +149,42 @@ final class TMembership
{
throw new TException('PageSize_bad',$pageSize);
}
- return self::$_Provider->GetAllUsers($pageIndex,$pageSize);
+ return self::$_provider->getAllUsers($pageIndex,$pageSize);
}
- private static function GetCurrentUserName()
+ private static function getCurrentUserName()
{
//how to get the current username?
}
- public static function GetNumberOfUsersOnline()
+ public static function getNumberOfUsersOnline()
{
- return self::$_Provider->GetNumberOfUsersOnline();
+ return self::$_provider->getNumberOfUsersOnline();
}
- public static function GetUser($username=null,$providerUserKey=null,$userIsOnline=false)
+ public static function getUser($username=null,$providerUserKey=null,$userIsOnline=false)
{
if ($username===null && $providerUserKey===null)
{
- return self::$_Provider->GetUser(self::GetCurrentUserName(),null,true);
+ return self::$_provider->getUser(self::GetCurrentUserName(),null,true);
}
if ($username===null && $providerUserKey!==null)
{
- return self::$_Provider->GetUser(null,$providerUserKey,$userIsOnline);
+ return self::$_provider->getUser(null,$providerUserKey,$userIsOnline);
}
if ($username!==null && $providerUserKey===null)
{
- return self::$_Provider->GetUser($username,null,$userIsOnline);
+ return self::$_provider->getUser($username,null,$userIsOnline);
}
}
- public static function GetUserNameByEmail($emailToMatch)
+ public static function getUserNameByEmail($emailToMatch)
{
- return self::$_Provider->GetUserNameByEmail($emailToMatch);
+ return self::$_provider->getUserNameByEmail($emailToMatch);
}
- private static function Initialize()
+ private static function initialize()
{
- if (self::$__s_Initialized)
+ if (self::$_initialized)
{
- if (self::$__s_InitializeException!==null)
+ if (self::$_initializeException!==null)
{
- throw new self::$__s_InitializeException;
+ throw new self::$_initializeException;
}
}
else
@@ -190,17 +192,17 @@ final class TMembership
}
}
- public static function UpdateUser(TMembershipUser $user)
+ public static function updateUser(TMembershipUser $user)
{
if ($user===null)
{
throw new TException('Membership_user_can_not_be_null');
}
- $user->Update();
+ $user->update();
}
- public static function ValidateUser($username,$password)
+ public static function validateUser($username,$password)
{
- return self::$_Provider->ValidateUser($username,$password);
+ return self::$_provider->validateUser($username,$password);
}
}
?> \ No newline at end of file
diff --git a/framework/Web/Security/TMembershipProvider.php b/framework/Web/Security/TMembershipProvider.php
index 674f338c..6a54819d 100644
--- a/framework/Web/Security/TMembershipProvider.php
+++ b/framework/Web/Security/TMembershipProvider.php
@@ -11,56 +11,169 @@
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;
+ private $_applicationName;
+ private $_enablePasswordReset=false;
+ private $_enablePasswordRetrieval=false;
+ private $_maxInvalidPasswordAttempts;
+ private $_minRequiredNonAlphanumericCharacters;
+ private $_minRequiredPasswordLength;
+ private $_passwordAttemptWindow;
+ private $_passwordStrengthRegularExpression;
+ private $_requiresQuestionAndAnswer=false;
+ private $_requiresUniqueEmail=false;
+ /**
+ * @var string external configuration file
+ */
+ private $_configFile=null;
+
+ public function getEnablePasswordReset()
+ {
+ return $this->_enablePasswordReset;
+ }
+ public function setEnablePasswordReset($value)
+ {
+ $this->_enablePasswordReset = TPropertyValue::ensureBoolean($value);
+ }
+ public function getEnablePasswordRetrieval()
+ {
+ return $this->_enablePasswordRetrieval;
+ }
+ public function setEnablePasswordRetrieval($value)
+ {
+ $this->_enablePasswordRetrieval = TPropertyValue::ensureBoolean($value);
+ }
+ public function getMaxInvalidPasswordAttempts()
+ {
+ return $this->_maxInvalidPasswordAttempts;
+ }
+ public function setMaxInvalidPasswordAttempts($value)
+ {
+ $this->_maxInvalidPasswordAttempts = TPropertyValue::ensureInteger($value);
+ }
+ public function getMinRequiredNonAlphanumericCharacters()
+ {
+ return $this->_minRequiredNonAlphanumericCharacters;
+ }
+ public function setMinRequiredNonAlphanumericCharacters($value)
+ {
+ $this->_minRequiredNonAlphanumericCharacters = TPropertyValue::ensureInteger($value);
+ }
+ public function getMinRequiredPasswordLength()
+ {
+ return $this->_minRequiredPasswordLength;
+ }
+ public function setMinRequiredPasswordLength($value)
+ {
+ $this->_minRequiredPasswordLength = TPropertyValue::ensureInteger($value);
+ }
+ public function getPasswordAttemptWindow()
+ {
+ return $this->_passwordAttemptWindow;
+ }
+ public function setPasswordAttemptWindow($value)
+ {
+ $this->_passwordAttemptWindow = TPropertyValue::ensureInteger($value);
+ }
+ public function getPasswordStrengthRegularExpression()
+ {
+ return $this->_passwordStrengthRegularExpression;
+ }
+ public function setPasswordStrengthRegularExpression($value)
+ {
+ $this->_passwordStrengthRegularExpression = TPropertyValue::ensureString($value);
+ }
+ public function getRequiresQuestionAndAnswer()
+ {
+ return $this->_requiresQuestionAndAnswer;
+ }
+ public function setRequiresQuestionAndAnswer($value)
+ {
+ $this->_requiresQuestionAndAnswer = TPropertyValue::ensureString($value);
+ }
+ public function getRequiresUniqueEmail()
+ {
+ return $this->_requiresUniqueEmail;
+ }
+ public function setRequiresUniqueEmail($value)
+ {
+ $this->_requiresUniqueEmail = TPropertyValue::ensureBoolean($value);
+ }
- protected function __construct()
+ public 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 function init($config)
{
-
+ if($this->_configFile!==null)
+ {
+ if(is_file($this->_configFile))
+ {
+ $dom=new TXmlDocument;
+ $dom->loadFromFile($this->_configFile);
+ $this->loadConfig($dom);
+ }
+ else
+ throw new TConfigurationException('membershipprovider_configfile_invalid',$this->_configFile);
+ }
+ $this->loadConfig($config);
+// $this->getApplication()->attachEventHandler('OnEndRequest',array($this,'collectLogs'));
}
- public abstract function DeleteUser($username,$deleteAllRelatedData);
- public function EncodePassword($pass,$passwordFormat,$salt)
+ /**
+ * Loads configuration from an XML element
+ * @param TXmlElement configuration node
+ * @throws TConfigurationException if log route class or type is not specified
+ */
+ private function loadConfig($xml)
{
-
+ foreach($xml->getElementsByTagName('provider') as $providerConfig)
+ {
+ $properties=$providerConfig->getAttributes();
+ if(($class=$properties->remove('class'))===null)
+ throw new TConfigurationException('membershipprovider_routeclass_required');
+ $provider=Prado::createComponent($class);
+ if(!($provider instanceof TMembershipProvider))
+ throw new TConfigurationException('membershipprovider_routetype_invalid');
+ foreach($properties as $name=>$value)
+ $provider->setSubproperty($name,$value);
+ $this->_providers[]=$provider;
+ $provider->init($providerConfig);
+ }
}
- protected function EncryptPassword($password)
+ 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 FindUsersByEmail($emailToMatch,$pageIndex=null,$pageSize=null);
- public abstract function FindUsersByName($usernameToMatch,$pageIndex=null,$pageSize=null);
- public function GenerateSalt()
+ public abstract function deleteUser($username,$deleteAllRelatedData);
+ public function encodePassword($pass,$passwordFormat,$salt)
{
-
+
+ }
+ protected function encryptPassword($password)
+ {
+
}
- 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 findUsersByEmail($emailToMatch,$pageIndex=null,$pageSize=null);
+ public abstract function findUsersByName($usernameToMatch,$pageIndex=null,$pageSize=null);
+ public function generateSalt()
{
}
- public abstract function UnlockUser($userName);
- public abstract function UpdateUser(TMembershipUser $user);
- public abstract function ValidateUser($username,$password);
+ public abstract function getAllUsers($pageIndex=null,$pageSize=null);
+ public abstract function getNumberOfUsersOnline();
+ public abstract function getPassword($username,$answer);
+ public abstract function getMembershipUser($username=null,$providerUserKey=null,$userIsOnline=false);
+ 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
index 722459fc..ad7b9f78 100644
--- a/framework/Web/Security/TMembershipUser.php
+++ b/framework/Web/Security/TMembershipUser.php
@@ -8,39 +8,28 @@
* @package System.Web.Security
* @since 3.1
*/
+Prado::using('System.Web.Security.TProviderException');
+Prado::using('System.Web.Security.TMembership');
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;
+ private $_comment;
+ private $_creationDate;
+ private $_email;
+ private $_isApproved=false;
+ private $_isLockedOut=false;
+ private $_isOnline=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))
+ if (($providerName===null) || (TMembership::getProviders($providerName)===null))
{
throw new TProviderException('Membership_provider_name_invalid',$providerName);
}
@@ -56,123 +45,119 @@ class TMembershipUser
{
$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;
+ $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;
+ return $this->_comment;
}
public function setApplicationName($value)
{
- $this->Comment = TPropertyValue::ensureString($value);
+ $this->_comment = TPropertyValue::ensureString($value);
}
public function getCreationDate()
{
- return $this->CreationDate;
+ return $this->_creationDate;
}
public function getEmail()
{
- return $this->Email;
+ return $this->_email;
}
public function setEmail($value)
{
- $this->Email = TPropertyValue::ensureString($value);
+ $this->_email = TPropertyValue::ensureString($value);
}
public function getIsApproved()
{
- return $this->IsApproved;
+ return $this->_isApproved;
}
public function setIsApproved($value)
{
- $this->IsApproved = TPropertyValue::ensureBoolean($value);
+ $this->_isApproved = TPropertyValue::ensureBoolean($value);
}
public function getIsLockedOut()
{
- return $this->IsLockedOut;
+ return $this->_isLockedOut;
}
public function getIsOnline()
{
- return $this->IsOnline;
+ return $this->_isOnline;
}
public function getLastActivityDate()
{
- return $this->LastActivityDate;
+ return $this->_lastActivityDate;
}
public function setLastActivityDate($value)
{
- $this->LastActivityDate = TPropertyValue::ensureString($value);
+ $this->_lastActivityDate = TPropertyValue::ensureString($value);
}
public function getLastLockoutDate()
{
- return $this->LastLockoutDate;
+ return $this->_lastLockoutDate;
}
public function getLastLoginDate()
{
- return $this->LastLoginDate;
+ return $this->_lastLoginDate;
}
public function setLastLoginDate($value)
{
- $this->LastLoginDate = TPropertyValue::ensureString($value);
+ $this->_lastLoginDate = TPropertyValue::ensureString($value);
}
public function getLastPasswordChangedDate()
{
- return $this->LastPasswordChangedDate;
- }
- public function getLastPasswordChangedDate()
- {
- return $this->LastPasswordChangedDate;
+ return $this->_lastPasswordChangedDate;
}
public function getPasswordQuestion()
{
- return $this->PasswordQuestion;
+ return $this->_passwordQuestion;
}
public function getProviderUserKey()
{
- return $this->ProviderUserKey;
+ return $this->_providerUserKey;
}
public function getUserName()
{
- return $this->UserName;
+ return $this->_userName;
}
- public function ChangePassword($oldPassword,$newPassword,$throwOnError=null)
+ public function changePassword($oldPassword,$newPassword,$throwOnError=null)
{
}
- public function GetPassword()
+ public function getPassword()
{
// $throwOnError;
// $passwordAnswer;
// $answer;
// $answer,$useAnswer,$throwOnError;
}
- public function ResetPassword()
+ public function resetPassword()
{
// $throwOnError;
// $passwordAnswer;
// $answer;
// $answer,$useAnswer,$throwOnError;
}
- public function UnlockUser()
+ public function unlockUser()
{
}
- public function Update()
+ public function update()
{
}
- private function UpdateSelf()
+ private function updateSelf()
{
}
diff --git a/framework/Web/Security/TRoleProvider.php b/framework/Web/Security/TRoleProvider.php
index d705be7e..a83bfb0b 100644
--- a/framework/Web/Security/TRoleProvider.php
+++ b/framework/Web/Security/TRoleProvider.php
@@ -11,22 +11,76 @@
Prado::using('System.Configuration.Provider.TProviderBase');
abstract class TRoleProvider extends TProviderBase
{
- private abstract $_ApplicationName;
- protected function __construct()
+ private $_cacheRolesInCookie=false;
+ private $_cookieName="PRADO";
+ private $_cookieTimeout="30";
+ private $_cookiePath="/";
+ private $_cookieRequireSSL=false;
+ private $_cookieSlidingExpiration=true;
+
+ public function getCacheRolesInCookie()
+ {
+ return $this->_cacheRolesInCookie;
+ }
+ public function setCacheRolesInCookie($value)
+ {
+ $this->_cacheRolesInCookie = TPropertyValue::ensureBoolean($value);
+ }
+ public function getCookieName()
+ {
+ return $this->_cookieName;
+ }
+ public function setCookieName($value)
+ {
+ $this->_cookieName = TPropertyValue::ensureString($value);
+ }
+ public function getCookiePath()
+ {
+ return $this->_cookiePath;
+ }
+ public function setCookiePath($value)
+ {
+ $this->_cookiePath = TPropertyValue::ensureString($value);
+ }
+ public function getCookieRequireSSL()
+ {
+ return $this->_cookieRequireSSL;
+ }
+ public function setCookieRequireSSL($value)
+ {
+ $this->_cookieRequireSSL = TPropertyValue::ensureBoolean($value);
+ }
+ public function getCookieSlidingExpiration()
+ {
+ return $this->_cookieSlidingExpiration;
+ }
+ public function setCookieSlidingExpiration($value)
+ {
+ $this->_cookieSlidingExpiration = TPropertyValue::ensureBoolean($value);
+ }
+ public function getCookieTimeout()
+ {
+ return $this->_cookieTimeout;
+ }
+ public function setCookieTimeout($value)
+ {
+ $this->_cookieTimeout = TPropertyValue::ensureInteger($value);
+ }
+
+
+ public 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);
+ public abstract function addUsersToRoles($usernames,$roleNames);
+ public abstract function createRole($roleName);
+ public abstract function deleteRole($roleName);
+ public abstract function findUsersInRole($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
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)
{
}
diff --git a/framework/Web/Security/TSqlMembershipProvider.php b/framework/Web/Security/TSqlMembershipProvider.php
new file mode 100644
index 00000000..6bd677f7
--- /dev/null
+++ b/framework/Web/Security/TSqlMembershipProvider.php
@@ -0,0 +1,83 @@
+<?php
+Prado::using('System.Web.Security.TMembershipProvider');
+class TSqlMembershipProvider extends TMembershipProvider
+{
+ private $_connectionStringName;
+
+ public function getConnectionStringName()
+ {
+ return $this->_connectionStringName;
+ }
+ public function setConnectionStringName($value)
+ {
+ $this->_connectionStringName = TPropertyValue::ensureString($value);
+ }
+
+
+ public function __construct()
+ {
+
+ }
+ public function changePassword($username,$oldPassword,$newPassword)
+ {
+
+ }
+ public function changePasswordQuestionAndAnswer($username,$password,$newPasswordQuestion,$newPasswordAnswer)
+ {
+
+ }
+ public function createUser($username,$password,$email,$passwordQuestion,$passwordAnswer,$isApproved,$providerUserKey)
+ {
+
+ }
+ public function deleteUser($username,$deleteAllRelatedData)
+ {
+
+ }
+ public function findUsersByEmail($emailToMatch,$pageIndex=null,$pageSize=null)
+ {
+
+ }
+ public function findUsersByName($usernameToMatch,$pageIndex=null,$pageSize=null)
+ {
+
+ }
+ public function getAllUsers($pageIndex=null,$pageSize=null)
+ {
+
+ }
+ public function getNumberOfUsersOnline()
+ {
+
+ }
+ public function getPassword($username,$answer)
+ {
+
+ }
+ public function getMembershipUser($username=null,$providerUserKey=null,$userIsOnline=false)
+ {
+ Prado::using('System.Web.Security.TMembershipUser');
+// return new TMembershipUser($this->getID());
+ }
+ public function getUserNameByEmail($email)
+ {
+
+ }
+ public function resetPassword($username,$answer)
+ {
+
+ }
+ public function unlockUser($userName)
+ {
+
+ }
+ public function updateUser(TMembershipUser $user)
+ {
+
+ }
+ public function validateUser($username,$password)
+ {
+
+ }
+}
+?> \ No newline at end of file
diff --git a/framework/Web/Security/TSqlRoleProvider.php b/framework/Web/Security/TSqlRoleProvider.php
index 24f5e38d..7eadc265 100644
--- a/framework/Web/Security/TSqlRoleProvider.php
+++ b/framework/Web/Security/TSqlRoleProvider.php
@@ -11,31 +11,60 @@
Prado::using('System.Web.Security.TRoleProvider');
class TSqlRoleProvider extends TRoleProvider
{
- private $_ApplicationName;
- protected function __construct()
+ private $_connectionStringName;
+
+ public function getConnectionStringName()
+ {
+ return $this->_connectionStringName;
+ }
+ public function setConnectionStringName($value)
+ {
+ $this->_connectionStringName = TPropertyValue::ensureString($value);
+ }
+
+ public function __construct()
+ {
+
+ }
+ public function addUsersToRoles($usernames,$roleNames)
{
}
- public function getApplicationName()
+ public function createRole($roleName)
{
- return $this->_ApplicationName;
+
+ }
+ public function deleteRole($roleName)
+ {
+
+ }
+ public function findUsersInRole($roleName,$usernameToMatch)
+ {
+
}
- public function setApplicationName($value)
+ public function getAllRoles()
{
- $this->_ApplicationName = TPropertyValue::ensureString($value);
+
+ }
+ public function getRolesForUser($username)
+ {
+
+ }
+ public function getUsersIsRole($username,$roleName)
+ {
+
+ }
+ public function isUserIsRole($username,$roleName)
+ {
+
+ }
+ public function removeUsersFromRoles($usernames,$roleNames)
+ {
+
}
- public function AddUsersToRoles($usernames,$roleNames)
+ public function roleExists($roleName)
{
}
- 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