diff options
Diffstat (limited to 'demos')
-rw-r--r-- | demos/providers/index.php | 20 | ||||
-rw-r--r-- | demos/providers/protected/.htaccess | 1 | ||||
-rw-r--r-- | demos/providers/protected/application.xml | 43 | ||||
-rw-r--r-- | demos/providers/protected/pages/Home.page | 4 | ||||
-rw-r--r-- | demos/providers/protected/pages/Home.php | 27 |
5 files changed, 95 insertions, 0 deletions
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 |