Author: sevein
Date: Wed Oct 27 02:41:32 2010
New Revision: 8533
Log:
Use $resource. Fixes issue 1835.
Modified:
trunk/apps/qubit/modules/user/actions/indexAction.class.php
trunk/apps/qubit/modules/user/templates/indexSuccess.php
Modified: trunk/apps/qubit/modules/user/actions/indexAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/user/actions/indexAction.class.php Wed Oct 27
02:22:20 2010 (r8532)
+++ trunk/apps/qubit/modules/user/actions/indexAction.class.php Wed Oct 27
02:41:32 2010 (r8533)
@@ -21,13 +21,17 @@
{
public function execute($request)
{
- $this->user = QubitUser::getById($this->request->id);
- $this->forward404Unless($this->user);
+ $this->resource = $this->getRoute()->resource;
- //except for administrators, only allow users to see their own profile
+ if (!isset($this->resource))
+ {
+ $this->forward404();
+ }
+
+ // 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');
}
Modified: trunk/apps/qubit/modules/user/templates/indexSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/user/templates/indexSuccess.php Wed Oct 27
02:22:20 2010 (r8532)
+++ trunk/apps/qubit/modules/user/templates/indexSuccess.php Wed Oct 27
02:41:32 2010 (r8533)
@@ -1,43 +1,43 @@
<?php echo get_component('user', 'aclMenu') ?>
-<h1><?php echo __('View user profile'); ?></h1>
+<h1><?php echo __('View user profile') ?></h1>
<?php if (SecurityCheck::HasPermission($sf_user, array('module' => 'user',
'action' => 'edit'))): ?>
- <?php echo link_to(__('<h1 class="label">%1% profile</h1>', array('%1%' =>
$user)), array($user, 'module' => 'user', 'action' => 'edit')) ?>
+ <?php echo link_to(__('<h1 class="label">%1% profile</h1>', array('%1%' =>
$resource)), array($resource, 'module' => 'user', 'action' => 'edit')) ?>
<?php else: ?>
- <h1 class="label"><?php echo $user.' profile' ?></h1>
+ <h1 class="label"><?php echo $resource.' profile' ?></h1>
<?php endif; ?>
<div class="section">
- <?php echo render_show(__('User name'), $user->username) ?>
+ <?php echo render_show(__('User name'), $resource->username) ?>
- <?php echo render_show(__('Email'), $user->email) ?>
+ <?php echo render_show(__('Email'), $resource->email) ?>
<?php if (!$sf_user->hasCredential('administrator')): ?>
- <div class="field">
- <h3><?php echo __('Password') ?></h3>
- <div><?php echo link_to(__('Reset password'), array($user, 'module' =>
'user', 'action' => 'passwordEdit')) ?></div>
- </div>
+ <div class="field">
+ <h3><?php echo __('Password') ?></h3>
+ <div><?php echo link_to(__('Reset password'), array($resource, 'module'
=> 'user', 'action' => 'passwordEdit')) ?></div>
+ </div>
<?php endif; ?>
- <?php if (0 < count($groups = $user->getAclGroups())): ?>
- <div class="field">
- <h3><?php echo __('User groups'); ?></h3>
- <div>
- <ul>
- <?php foreach ($groups as $group): ?>
- <?php if (100 <= $group->id): ?>
- <li><?php echo $group->__toString() ?></li>
- <?php else: ?>
- <li><span class="note2"><?php echo $group->__toString() ?></li>
- <?php endif; ?>
- <?php endforeach; ?>
- </ul>
+ <?php if (0 < count($groups = $resource->getAclGroups())): ?>
+ <div class="field">
+ <h3><?php echo __('User groups') ?></h3>
+ <div>
+ <ul>
+ <?php foreach ($groups as $item): ?>
+ <?php if (100 <= $item->id): ?>
+ <li><?php echo $item->__toString() ?></li>
+ <?php else: ?>
+ <li><span class="note2"><?php echo $item->__toString() ?></li>
+ <?php endif; ?>
+ <?php endforeach; ?>
+ </ul>
+ </div>
</div>
- </div>
<?php endif; ?>
</div>
-<?php echo get_partial('showActions', array('user' => $user)) ?>
+<?php echo get_partial('showActions', array('user' => $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.