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

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

#3214:added ability to delete an admin user

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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))
Note: See TracChangeset for help on using the changeset viewer.