Author: sevein
Date: Wed Oct 27 07:08:28 2010
New Revision: 8542

Log:
Use $resource. Cosmetic changes.

Modified:
   
trunk/apps/qubit/modules/user/actions/indexInformationObjectAclAction.class.php
   trunk/apps/qubit/modules/user/templates/indexInformationObjectAclSuccess.php

Modified: 
trunk/apps/qubit/modules/user/actions/indexInformationObjectAclAction.class.php
==============================================================================
--- 
trunk/apps/qubit/modules/user/actions/indexInformationObjectAclAction.class.php 
    Wed Oct 27 06:46:35 2010        (r8541)
+++ 
trunk/apps/qubit/modules/user/actions/indexInformationObjectAclAction.class.php 
    Wed Oct 27 07:08:28 2010        (r8542)
@@ -21,13 +21,16 @@
 {
   public function execute($request)
   {
-    $this->user = QubitUser::getById($this->request->id);
-    $this->forward404Unless($this->user);
+    $this->resource = $this->getRoute()->resource;
+    if (!isset($this->resource))
+    {
+      $this->forward404();
+    }
 
-    //except for administrators, only allow users to see their own profile
+    // Except for administrators, only allow users to see their own profile
     if (!$this->context->user->hasCredential('administrator'))
     {
-      if ($this->request->id != $this->context->user->getAttribute('user_id'))
+      if ($this->resource->id != $this->context->user->getAttribute('user_id'))
       {
         $this->redirect('admin/secure');
       }
@@ -35,7 +38,7 @@
 
     // Get user's groups
     $this->userGroups = array();
-    if (0 < count($aclUserGroups = $this->user->aclUserGroups))
+    if (0 < count($aclUserGroups = $this->resource->aclUserGroups))
     {
       foreach ($aclUserGroups as $aclUserGroup)
       {
@@ -54,7 +57,7 @@
     // Get access control permissions
     $criteria = new Criteria;
     $criteria->addJoin(QubitAclPermission::OBJECT_ID, QubitObject::ID, 
Criteria::LEFT_JOIN);
-    $c1 = $criteria->getNewCriterion(QubitAclPermission::USER_ID, 
$this->request->id);
+    $c1 = $criteria->getNewCriterion(QubitAclPermission::USER_ID, 
$this->resource->id);
 
     // Add group criteria
     if (1 == count($this->userGroups))
@@ -81,7 +84,7 @@
     $criteria->addAscendingOrderByColumn(QubitAclPermission::GROUP_ID);
 
     // Add user as final "group"
-    $this->userGroups[] = $this->user->username;
+    $this->userGroups[] = $this->resource->username;
 
     // Build ACL
     $this->acl = array();
@@ -94,7 +97,7 @@
         $objectId = (QubitInformationObject::ROOT_ID != $permission->objectId) 
? $permission->objectId : null;
 
         // Use username as "group" for permissions specific to user
-        $groupKey = (null !== $permission->groupId) ? $permission->groupId : 
$this->user->username;
+        $groupKey = (null !== $permission->groupId) ? $permission->groupId : 
$this->resource->username;
 
         $this->acl[$permission->getConstants(array('name' => 
'repositoryId'))][$objectId][$permission->action][$groupKey] = $permission;
       }

Modified: 
trunk/apps/qubit/modules/user/templates/indexInformationObjectAclSuccess.php
==============================================================================
--- 
trunk/apps/qubit/modules/user/templates/indexInformationObjectAclSuccess.php    
    Wed Oct 27 06:46:35 2010        (r8541)
+++ 
trunk/apps/qubit/modules/user/templates/indexInformationObjectAclSuccess.php    
    Wed Oct 27 07:08:28 2010        (r8542)
@@ -2,72 +2,67 @@
 
 <h1><?php echo __('View permissions') ?></h1>
 
-<h1 class="label"><?php echo $user->__toString() ?></h1>
+<h1 class="label"><?php echo $resource->__toString() ?></h1>
 
 <div class="section">
   <?php if (0 < count($acl)): ?>
-  <table id="userPermissions" class="inline sticky-enabled">
-    <thead>
-      <tr>
-      <th colspan="2">&nbsp;</th>
-      <?php foreach ($userGroups as $groupId): ?>
-        <?php if (null !== $group = QubitAclGroup::getById($groupId)): ?>
-        <th><?php echo $group->__toString() ?></th>
-        <?php elseif ($user->username == $groupId): ?>
-        <th><?php echo $user->username ?></th>
-        <?php endif; ?>
-      <?php endforeach; ?>
-      </tr>
-    </thead>
-
-    <tbody>
-    <?php foreach ($acl as $repoId => $objects): ?>
-      <?php foreach ($objects as $objectId => $actions): ?>
-      <tr>
-        <td colspan="<?php echo $tableCols ?>"><strong>
-        <?php if ('' == $repoId && '' == $objectId): ?>
-          <em><?php echo __('All %1%', array('%1%' => 
sfConfig::get('app_ui_label_informationobject'))) ?></em>
-        <?php elseif ('' != $repoId): ?>
-          <?php echo __('%1%: %2%', array('%1%' => 
sfConfig::get('app_ui_label_repository'), '%2%' => 
render_title(QubitRepository::getById($repoId)))) ?>
-        <?php else: ?>
-          <?php echo render_title(QubitInformationObject::getById($objectId)) 
?>
-        <?php endif; ?>
-        </strong></td>
-      </tr>
-
-    <?php $row = 0; ?>
-    <?php foreach ($actions as $action => $groupPermission): ?>
-      <tr class="<?php echo 0 == ++$row % 2 ? 'even' : 'odd' ?>">
-        <td>&nbsp;</td>
-        <td>
-        <?php if ('' != $action): ?>
-          <?php echo QubitInformationObjectAcl::$ACTIONS[$action] ?>
-        <?php else: ?>
-          <em><?php echo __('All privileges') ?></em>
-        <?php endif; ?>
-        </td>
-
-        <?php foreach ($userGroups as $groupId): ?>
-        <td>
-        <?php if (isset($groupPermission[$groupId]) && $permission = 
$groupPermission[$groupId]): ?>
-          <?php if ('translate' == $permission->action && null !== 
$permission->getConstants(array('name' => 'languages'))): ?>
-          <?php echo __('%1%: %2%', array('%1%' => 
$permission->renderAccess(), '%2%' => implode(', ', 
$permission->getConstants(array('name' => 'languages'))))) ?>
-          <?php else: ?>
-            <?php echo __($permission->renderAccess()) ?>
-          <?php endif; ?>
-        <?php else: ?>
-          <?php echo '-' ?>
-        <?php endif; ?>
-        </td>
+    <table id="userPermissions" class="inline sticky-enabled">
+      <thead>
+        <tr>
+          <th colspan="2">&nbsp;</th>
+          <?php foreach ($userGroups as $item): ?>
+            <?php if (null !== $group = QubitAclGroup::getById($item)): ?>
+              <th><?php echo $group->__toString() ?></th>
+            <?php elseif ($resource->username == $item): ?>
+              <th><?php echo $resource->username ?></th>
+            <?php endif; ?>
+          <?php endforeach; ?>
+        </tr>
+      </thead><tbody>
+        <?php foreach ($acl as $repoId => $objects): ?>
+          <?php foreach ($objects as $objectId => $actions): ?>
+            <tr>
+              <td colspan="<?php echo $tableCols ?>"><strong>
+                <?php if ('' == $repoId && '' == $objectId): ?>
+                  <em><?php echo __('All %1%', array('%1%' => 
sfConfig::get('app_ui_label_informationobject'))) ?></em>
+                <?php elseif ('' != $repoId): ?>
+                  <?php echo __('%1%: %2%', array('%1%' => 
sfConfig::get('app_ui_label_repository'), '%2%' => 
render_title(QubitRepository::getById($repoId)))) ?>
+                <?php else: ?>
+                  <?php echo 
render_title(QubitInformationObject::getById($objectId)) ?>
+                <?php endif; ?>
+              </strong></td>
+            </tr>
+            <?php $row = 0; ?>
+            <?php foreach ($actions as $action => $groupPermission): ?>
+              <tr class="<?php echo 0 == ++$row % 2 ? 'even' : 'odd' ?>">
+                <td>&nbsp;</td>
+                <td>
+                  <?php if ('' != $action): ?>
+                    <?php echo QubitInformationObjectAcl::$ACTIONS[$action] ?>
+                  <?php else: ?>
+                    <em><?php echo __('All privileges') ?></em>
+                  <?php endif; ?>
+                </td>
+                <?php foreach ($userGroups as $groupId): ?>
+                  <td>
+                    <?php if (isset($groupPermission[$groupId]) && $permission 
= $groupPermission[$groupId]): ?>
+                      <?php if ('translate' == $permission->action && null !== 
$permission->getConstants(array('name' => 'languages'))): ?>
+                        <?php echo __('%1%: %2%', array('%1%' => 
$permission->renderAccess(), '%2%' => implode(', ', 
$permission->getConstants(array('name' => 'languages'))))) ?>
+                      <?php else: ?>
+                        <?php echo __($permission->renderAccess()) ?>
+                      <?php endif; ?>
+                    <?php else: ?>
+                      <?php echo '-' ?>
+                    <?php endif; ?>
+                  </td>
+                <?php endforeach; ?>
+              </tr>
+            <?php endforeach; ?>
+          <?php endforeach; ?>
         <?php endforeach; ?>
-      </tr>
-    <?php endforeach; ?>
-    <?php endforeach; ?>
-    <?php endforeach; ?>
-    </tbody>
-  </table>
-<?php endif; ?>
-
+      </tbody>
+    </table>
+  <?php endif; ?>
 </div>
 
-<?php echo get_partial('showActions', array('user' => $user)) ?>
+<?php echo get_partial('showActions', array('resource' => $resource)) ?>

-- 
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.com/group/qubit-commits?hl=en.

Reply via email to