diff options
author | wei <> | 2006-07-17 23:19:39 +0000 |
---|---|---|
committer | wei <> | 2006-07-17 23:19:39 +0000 |
commit | 319df8f534520c8c926d0cdaa1f5577c7bd8a909 (patch) | |
tree | 743a3a2e3e7092e0f474baf8592b3ba3824fc506 /demos/time-tracker/protected/pages/TimeTracker/UserCreate.php | |
parent | b230beea20bc18f05d51b8e1f76c99c74a12fff4 (diff) |
Update time-tracker application
Diffstat (limited to 'demos/time-tracker/protected/pages/TimeTracker/UserCreate.php')
-rw-r--r-- | demos/time-tracker/protected/pages/TimeTracker/UserCreate.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php b/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php index 49e64458..f163ecd6 100644 --- a/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php +++ b/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php @@ -54,18 +54,26 @@ class UserCreate extends TPage $newUser->EmailAddress = $this->email->Text;
$newUser->Name = $this->username->Text;
$newUser->IsGuest = false;
- $newUser->Roles = $this->Application->Parameters['NewUserRoles'];
+ if($this->User->isInRole('admin'))
+ $newUser->Roles = $this->role->SelectedValue;
+ else
+ $newUser->Roles = $this->Application->Parameters['NewUserRoles'];
//save the user
$userDao = $this->Application->Modules['daos']->getDao('UserDao');
$userDao->addNewUser($newUser, $this->password->Text);
//update the user
- $this->User->Manager->updateCredential($newUser);
-
- //return to requested page
- $this->Response->redirect($auth->getReturnUrl());
+ if(!$this->User->isInRole('admin'))
+ {
+ $auth = $this->Application->getModule('auth');
+ $auth->updateCredential($newUser);
+ //return to requested page
+ $this->Response->redirect($auth->getReturnUrl());
+ }
+ else
+ $this->Response->reload();
//goto default page.
//$url = $this->Service->constructUrl($this->Service->DefaultPage);
//$this->Response->redirect($url);
|