ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 9956


Ignore:
Timestamp:
Jan 6, 2009, 7:54:08 PM (12 years ago)
Author:
ebihara
Message:

#3214:added ability to delete an admin user

Location:
OpenPNE3/trunk/apps/pc_backend
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/pc_backend/lib/myUser.class.php

    r7799 r9956  
    33class myUser extends sfBasicSecurityUser
    44{
     5  public function getId()
     6  {
     7    return $this->getAttribute('adminUserId', null, 'adminUser');
     8  }
    59}
  • OpenPNE3/trunk/apps/pc_backend/modules/admin/actions/actions.class.php

    r9955 r9956  
    4646
    4747 /**
     48  * Executes deleteUser action
     49  *
     50  * @param sfRequest $request A request object
     51  */
     52  public function executeDeleteUser(sfWebRequest $request)
     53  {
     54    $this->user = AdminUserPeer::retrieveByPk($request->getParameter('id'));
     55    $this->forward404Unless($this->user);
     56    $this->forward404If($this->user->getId() == $this->getUser()->getId());
     57    $this->forward404If($this->user->getId() == 1);
     58
     59    $this->form = new sfForm();
     60    if ($request->isMethod(sfWebRequest::POST))
     61    {
     62      $field = $this->form->getCSRFFieldName();
     63      $this->form->bind(array($field => $request->getParameter($field)));
     64      if ($this->form->isValid())
     65      {
     66        $this->user->delete();
     67        $this->redirect('admin/manageUser');
     68      }
     69    }
     70  }
     71
     72 /**
    4873  * Executes editPassword action
    4974  *
     
    5277  public function executeEditPassword(sfWebRequest $request)
    5378  {
    54     $user = AdminUserPeer::retrieveByPk($this->getUser()->getAttribute('adminUserId', null, 'adminUser'));
     79    $user = AdminUserPeer::retrieveByPk($this->getUser()->getId());
    5580    $this->form = new AdminUserEditPasswordForm($user);
    5681    if ($request->isMethod(sfWebRequest::POST))
  • OpenPNE3/trunk/apps/pc_backend/modules/admin/templates/manageUserSuccess.php

    r9954 r9956  
    1818<th><?php echo $user->getId() ?></th>
    1919<td><?php echo $user->getUsername() ?></td>
    20 <td><?php if ($user->getId() != 1) : ?><?php echo link_to(__('削除'), 'admin/deleteUser') ?><?php endif; ?></td>
     20<td><?php if ($user->getId() != 1 && $user->getId() != $sf_user->getId()) : ?>
     21<?php echo link_to(__('削除'), 'admin/deleteUser?id='.$user->getId()) ?>
     22<?php endif; ?></td>
    2123</tr>
    2224<?php endforeach; ?>
Note: See TracChangeset for help on using the changeset viewer.