示例#1
0
文件: User.php 项目: apioo/fusio-impl
 public function update($userId, $status, $name, $email, array $scopes = null)
 {
     $user = $this->userTable->get($userId);
     if (!empty($user)) {
         // check values
         $this->assertName($name);
         $this->assertEmail($email);
         try {
             $this->userTable->beginTransaction();
             $this->userTable->update(array('id' => $user['id'], 'status' => $status, 'name' => $name, 'email' => $email));
             // delete existing scopes
             $this->userScopeTable->deleteAllFromUser($user['id']);
             // add scopes
             $this->insertScopes($user['id'], $scopes);
             $this->userTable->commit();
         } catch (\Exception $e) {
             $this->userTable->rollBack();
             throw $e;
         }
     } else {
         throw new StatusCode\NotFoundException('Could not find user');
     }
 }