src/snac/server/ServerExecutor.php
/**
     * Update the User Information
     *
     * Calls saveUser to save the user information to the database.  Then returns the user object.
     *
     * @param string[]|null $input The input from the client
     * @return string[] The response to send to the client
     */
Update the User Information
Calls saveUser to save the user information to the database.  Then returns the user object.

@param string[]|null $input The input from the client
@return string[] The response to send to the client
Update the User Information Calls saveUser to save the user information to the database . Then returns the user object . @param string [] |null $input The input from the client @return string [] The response to send to the client
public function updateUserInformation(&$input) {
        $response = array();
        $updated = new \snac\data\User($input["user_update"]);
        $success = false;
        if ($this->user->getUserName() == $updated->getUserName()) {
            $this->user->setFirstName($updated->getFirstName());
            $this->user->setLastName($updated->getLastName());
            $this->user->setFullName($updated->getFullName());
            $this->user->setEmail($updated->getEmail());
            $this->user->setWorkEmail($updated->getWorkEmail());
            $this->user->setWorkPhone($updated->getWorkPhone());
            $success = $this->uStore->saveUser($this->user);
            if ($success === true)
                $response["user_update"] = $this->user->toArray();
        } else {
            if ($this->uStore->readUser($updated) !== false) {
                $success = $this->uStore->saveUser($updated, true);
                if ($success === false) {
                    $response["error"] = "Could not save the user";
                }
            } else {
                $updated = $this->uStore->createUser($updated, true);
                if ($updated !== false)
                    $success = true;
                else
                    $response["error"] = "Could not create the user";
            }
            if ($success === true) {
                $retUser = $this->uStore->readUser($updated);
                if (isset($input["groups_update"]) && is_array($input["groups_update"])) {
                    $currentGroups = $this->uStore->listGroupsForUser($retUser);
                    foreach ($currentGroups as $current) {
                        $this->uStore->removeUserFromGroup($retUser, $current);
                    }
                    foreach ($input["groups_update"] as $newGroup) {
                        $this->uStore->addUserToGroup($retUser, new \snac\data\Group($newGroup));
                    }
                }
                $response["user_update"] = $retUser->toArray();
            }
        }
        if ($success === true) {
            $response["result"] = "success";
        } else {
            $response["result"] = "failure";
        }
        return $response;
    }
public function updateUserInformation ( & $ input ) { $ response = array ( ) ; $ updated = new \ snac \ data \ User ( $ input [ " user_update " ] ) ; $ success = false ; if ( $ this -> user -> getUserName ( ) == $ updated -> getUserName ( ) ) { $ this -> user -> setFirstName ( $ updated -> getFirstName ( ) ) ; $ this -> user -> setLastName ( $ updated -> getLastName ( ) ) ; $ this -> user -> setFullName ( $ updated -> getFullName ( ) ) ; $ this -> user -> setEmail ( $ updated -> getEmail ( ) ) ; $ this -> user -> setWorkEmail ( $ updated -> getWorkEmail ( ) ) ; $ this -> user -> setWorkPhone ( $ updated -> getWorkPhone ( ) ) ; $ success = $ this -> uStore -> saveUser ( $ this -> user ) ; if ( $ success === true ) $ response [ " user_update " ] = $ this -> user -> toArray ( ) ; } else { if ( $ this -> uStore -> readUser ( $ updated ) !== false ) { $ success = $ this -> uStore -> saveUser ( $ updated , true ) ; if ( $ success === false ) { $ response [ " error " ] = " Could not save the user " ; } } else { $ updated = $ this -> uStore -> createUser ( $ updated , true ) ; if ( $ updated !== false ) $ success = true ; else $ response [ " error " ] = " Could not create the user " ; } if ( $ success === true ) { $ retUser = $ this -> uStore -> readUser ( $ updated ) ; if ( isset ( $ input [ " groups_update " ] ) && is_array ( $ input [ " groups_update " ] ) ) { $ currentGroups = $ this -> uStore -> listGroupsForUser ( $ retUser ) ; foreach ( $ currentGroups as $ current ) { $ this -> uStore -> removeUserFromGroup ( $ retUser , $ current ) ; } foreach ( $ input [ " groups_update " ] as $ newGroup ) { $ this -> uStore -> addUserToGroup ( $ retUser , new \ snac \ data \ Group ( $ newGroup ) ) ; } } $ response [ " user_update " ] = $ retUser -> toArray ( ) ; } } if ( $ success === true ) { $ response [ " result " ] = " success " ; } else { $ response [ " result " ] = " failure " ; } return $ response ; }
Update the User Information
 Calls saveUser to save the user information to the database.
Update the User Information Calls saveUser to save the user information to the database .
// If the user was successfully created or saved, then modify their groups and return the full user object // If we have groups to modify, then update them appropriately.   To remove all groups, the parameter // must be sent as an empty array