public function addUser($username, $passwd = null, $active = null, $extra = null)
    {
        $userDocument         = new User();
        $userDocument->user   = $username;
        $userDocument->passwd = $passwd;
        $userDocument->active = $active;
        $userDocument->extra  = $extra;
        $data                 = $userDocument->getAll();

        $this->getConnection()->post(Urls::URL_USER, $this->json_encode_wrapper($data));

        try {
            // additionally set user permissions in the current databases
            $this->grantPermissions($username, $this->getConnection()->getDatabase());
        } catch (\Exception $e) {
        }

        return true;
    }
public function addUser($username, $passwd = null, $active = null, $extra = null)
    {
        $userDocument         = new User();
        $userDocument->user   = $username;
        $userDocument->passwd = $passwd;
        $userDocument->active = $active;
        $userDocument->extra  = $extra;
        $data                 = $userDocument->getAll();

        $this->getConnection()->post(Urls::URL_USER, $this->json_encode_wrapper($data));

        try {
            // additionally set user permissions in the current databases
            $this->grantPermissions($username, $this->getConnection()->getDatabase());
        } catch (\Exception $e) {
        }

        return true;
    }
public function addUser ( $ username , $ passwd = null , $ active = null , $ extra = null ) { $ userDocument = new User ( ) ; $ userDocument -> user = $ username ; $ userDocument -> passwd = $ passwd ; $ userDocument -> active = $ active ; $ userDocument -> extra = $ extra ; $ data = $ userDocument -> getAll ( ) ; $ this -> getConnection ( ) -> post ( Urls :: URL_USER , $ this -> json_encode_wrapper ( $ data ) ) ; try { // additionally set user permissions in the current databases $ this -> grantPermissions ( $ username , $ this -> getConnection ( ) -> getDatabase ( ) ) ; } catch ( \ Exception $ e ) { } return true ; }
save a user to the user-collection

This will save the user to the users collection. It will additionally grant the user permissions
for the current database

This will throw if the user cannot be saved

@throws Exception

@param string $username - The name of the user as a string. This is mandatory.
@param mixed  $passwd   - The user password as a string. If no password is specified, the empty string will be used.
@param mixed  $active   - an optional flag that specifies whether the user is active. If not specified, this will default to true.
@param array  $extra    - an optional array with arbitrary extra data about the user.

@return boolean - true, if user could be saved
@since 1.2
save a user to the user - collection