Author: david
Date: Thu Sep 17 16:26:23 2009
New Revision: 3389

Log:
Eliminate QubitUser::getRoles() and replace with QubitUser::getAclGroups().  
Switch to acl groups for determining user credentials on login.

Modified:
   trunk/apps/qubit/lib/myUser.class.php
   trunk/apps/qubit/modules/user/templates/listSuccess.php
   trunk/lib/model/QubitUser.php

Modified: trunk/apps/qubit/lib/myUser.class.php
==============================================================================
--- trunk/apps/qubit/lib/myUser.class.php       Thu Sep 17 16:15:31 2009        
(r3388)
+++ trunk/apps/qubit/lib/myUser.class.php       Thu Sep 17 16:26:23 2009        
(r3389)
@@ -23,9 +23,9 @@
   {
     $this->setAuthenticated(true);
 
-    foreach ($user->getRoles() as $role)
+    foreach ($user->getAclGroups() as $group)
     {
-      $this->addCredential((string) $role);
+      $this->addCredential($group->getName(array('culture' => 'en')));
     }
 
     $this->setAttribute('user_id', $user->getId());
@@ -68,7 +68,7 @@
       $error = 'invalid username';
     }
 
-    $user = QubitUser::checkCredentials($username, $password, &$error);
+    $user = QubitUser::checkCredentials($username, $password, $error);
 
     // user account exists?
     if ($user !== null)

Modified: trunk/apps/qubit/modules/user/templates/listSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/user/templates/listSuccess.php     Thu Sep 17 
16:15:31 2009        (r3388)
+++ trunk/apps/qubit/modules/user/templates/listSuccess.php     Thu Sep 17 
16:26:23 2009        (r3389)
@@ -15,8 +15,8 @@
 <tr>
   <td><?php echo link_to($user->getUsername(), array('module' => 'user', 
'action' => 'show', 'id' => $user->getId())) ?></td>
   <td><?php echo $user->getEmail() ?></td>
-  <td><?php foreach ($user->getRoles() as $role): ?>
-        <?php echo $role ?><br />
+  <td><?php foreach ($user->getAclGroups() as $group): ?>
+        <?php echo $group ?><br />
       <?php endforeach; ?>
   </td>
 </tr>

Modified: trunk/lib/model/QubitUser.php
==============================================================================
--- trunk/lib/model/QubitUser.php       Thu Sep 17 16:15:31 2009        (r3388)
+++ trunk/lib/model/QubitUser.php       Thu Sep 17 16:26:23 2009        (r3389)
@@ -34,20 +34,20 @@
     $this->setSha1Password(sha1($salt.$password));
   }
 
-  public function getRoles()
+  public function getAclGroups()
   {
-    $roles = array();
-    foreach ($this->getUserRoleRelations() as $relation)
+    $groups = array();
+    foreach ($this->getAclUserGroups() as $userGroup)
     {
-      $roles[] = $relation->getRole();
+      $groups[] = $userGroup->getGroup();
     }
 
-    return $roles;
+    return $groups;
   }
 
   public function getUserCredentials()
   {
-    return $this->getRoles();
+    return $this->getAclGroups();
   }
 
   public static function getList($options=array())

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" 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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to