Author: allyb
Date: 2010-02-16 15:10:39 +0100 (Tue, 16 Feb 2010)
New Revision: 28054
Modified:
plugins/sfEasyAuthPlugin/trunk/config/schema.yml
plugins/sfEasyAuthPlugin/trunk/lib/filter/sfEasyAuthUserFormFilter.class.php
plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUser.php
plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUserCredentialPeer.php
plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUserPeer.php
plugins/sfEasyAuthPlugin/trunk/lib/user/sfEasyAuthSecurityUser.class.php
Log:
Fixed various bugs in the admin area
Modified: plugins/sfEasyAuthPlugin/trunk/config/schema.yml
===================================================================
--- plugins/sfEasyAuthPlugin/trunk/config/schema.yml 2010-02-16 12:56:47 UTC
(rev 28053)
+++ plugins/sfEasyAuthPlugin/trunk/config/schema.yml 2010-02-16 14:10:39 UTC
(rev 28054)
@@ -34,6 +34,7 @@
foreignTable: sf_easy_auth_user
foreignReference: id
required: true
+ onDelete: cascade
primaryKey: true
credential: { type: varchar(60), required: true, primaryKey: true }
profile_id: { type: integer, required: false, default: null }
Modified:
plugins/sfEasyAuthPlugin/trunk/lib/filter/sfEasyAuthUserFormFilter.class.php
===================================================================
---
plugins/sfEasyAuthPlugin/trunk/lib/filter/sfEasyAuthUserFormFilter.class.php
2010-02-16 12:56:47 UTC (rev 28053)
+++
plugins/sfEasyAuthPlugin/trunk/lib/filter/sfEasyAuthUserFormFilter.class.php
2010-02-16 14:10:39 UTC (rev 28054)
@@ -14,7 +14,7 @@
{
$this->useFields(array('username', 'email', 'locked_by_admins'));
- $credentials = array_merge(array('' => 'Any'),
sfEasyAuthUserPeer::getDistinctAssignedCredentialsAsArray());
+ $credentials = array_merge(array('' => 'Any'),
sfEasyAuthUserCredentialPeer::getAllCredentialsAsArray());
$this->widgetSchema['credential'] = new sfWidgetFormChoice(
array(
Modified: plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUser.php
===================================================================
--- plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUser.php 2010-02-16
12:56:47 UTC (rev 28053)
+++ plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUser.php 2010-02-16
14:10:39 UTC (rev 28054)
@@ -196,7 +196,8 @@
// reload the credentials on the sfUser object too if the current user
// has had a new credential added
- if ($this->getId() ===
sfContext::getInstance()->getUser()->getAuthUser()->getId())
+ if (is_object(sfContext::getInstance()->getUser()->getAuthUser()) &&
+ $this->getId() ===
sfContext::getInstance()->getUser()->getAuthUser()->getId())
{
sfContext::getInstance()->getUser()->refreshCredentials();
}
@@ -654,7 +655,7 @@
*/
public function getPossibleCredentials()
{
- $credentials = sfEasyAuthUserPeer::getDistinctAssignedCredentialsAsArray();
+ $credentials = sfEasyAuthUserCredentialPeer::getAllCredentialsAsArray();
foreach
(sfEasyAuthUtils::arrayFlatten($this->parseCredentialInheritanceDefinition())
as $credential)
{
Modified:
plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUserCredentialPeer.php
===================================================================
--- plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUserCredentialPeer.php
2010-02-16 12:56:47 UTC (rev 28053)
+++ plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUserCredentialPeer.php
2010-02-16 14:10:39 UTC (rev 28054)
@@ -6,14 +6,26 @@
* Queries the user_credentials and user table to find all types and
credentials that
* have been set
*
- * @return array
+ * @return array An associative array of credentials as strings
*/
- public static function retrieveAllCredentials()
+ public static function getAllCredentialsAsArray()
{
$c = new Criteria();
+ $c->addSelectColumn(self::CREDENTIAL);
$c->setDistinct();
- return self::doSelect($c);
+ $credentials = array();
+
+ $stmt = BasePeer::doSelect($c);
+
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC))
+ {
+ $credentials[$row['CREDENTIAL']] = $row['CREDENTIAL'];
+ }
+
+ asort($credentials);
+
+ return $credentials;
}
/**
Modified: plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUserPeer.php
===================================================================
--- plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUserPeer.php
2010-02-16 12:56:47 UTC (rev 28053)
+++ plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUserPeer.php
2010-02-16 14:10:39 UTC (rev 28054)
@@ -89,24 +89,4 @@
return self::doSelectOne($c);
}
-
- /**
- * Returns an array of credentials that are used in the database
- *
- * @return array An array of credentials assigned to any user
- */
- public static function getDistinctAssignedCredentialsAsArray()
- {
- $credentials = array();
-
- foreach (sfEasyAuthUserCredentialPeer::retrieveAllCredentials() as
$credential)
- {
- $credentialName = $credential->getCredential();
- $credentials[$credentialName] = $credentialName;
- }
-
- asort($credentials);
-
- return $credentials;
- }
}
Modified:
plugins/sfEasyAuthPlugin/trunk/lib/user/sfEasyAuthSecurityUser.class.php
===================================================================
--- plugins/sfEasyAuthPlugin/trunk/lib/user/sfEasyAuthSecurityUser.class.php
2010-02-16 12:56:47 UTC (rev 28053)
+++ plugins/sfEasyAuthPlugin/trunk/lib/user/sfEasyAuthSecurityUser.class.php
2010-02-16 14:10:39 UTC (rev 28054)
@@ -298,7 +298,7 @@
{
$this->clearCredentials();
- foreach ($eaUser->getCredentials() as $credential)
+ foreach ($this->getAuthUser()->getCredentials() as $credential)
{
$this->addCredential($credential);
}
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.