booked/WebServices/AccountWebService.php
/**
     * @name CreateAccount
     * @description Creates a user account. This does not authenticate
     * @request CreateAccountRequest
     * @response AccountCreatedResponse
     * @return void
     */
@name CreateAccount
@description Creates a user account. This does not authenticate
@request CreateAccountRequest
@response AccountCreatedResponse
@return void
@name CreateAccount @description Creates a user account . This does not authenticate @request CreateAccountRequest @response AccountCreatedResponse @return void
public function Create()
    {
        if (!Configuration::Instance()->GetSectionKey(ConfigSection::API, ConfigKeys::ALLOW_REGISTRATION, new BooleanConverter()))
        {
            $this->server->WriteResponse(new FailedResponse($this->server, array('allow.self.registration is not enabled for the API')),
                RestResponse::UNAUTHORIZED_CODE);
            return;
        }
        $request = new CreateAccountRequest($this->server->GetRequest());
        Log::Debug('AccountWebService.Create()');
        $result = $this->controller->Create($request);
        if ($result->WasSuccessful())
        {
            Log::Debug('AccountWebService.Create() - User Created. Created UserId=%s', $result->UserId());
            $this->server->WriteResponse(new AccountActionResponse($this->server, $result->UserId()),
                RestResponse::CREATED_CODE);
        }
        else
        {
            Log::Debug('AccountWebService.Create() - User Create Failed.');
            $this->server->WriteResponse(new FailedResponse($this->server, $result->Errors()),
                RestResponse::BAD_REQUEST_CODE);
        }
    }
public function Create ( ) { if ( ! Configuration :: Instance ( ) -> GetSectionKey ( ConfigSection :: API , ConfigKeys :: ALLOW_REGISTRATION , new BooleanConverter ( ) ) ) { $ this -> server -> WriteResponse ( new FailedResponse ( $ this -> server , array ( 'allow.self.registration is not enabled for the API' ) ) , RestResponse :: UNAUTHORIZED_CODE ) ; return ; } $ request = new CreateAccountRequest ( $ this -> server -> GetRequest ( ) ) ; Log :: Debug ( 'AccountWebService.Create()' ) ; $ result = $ this -> controller -> Create ( $ request ) ; if ( $ result -> WasSuccessful ( ) ) { Log :: Debug ( 'AccountWebService.Create() - User Created. Created UserId=%s' , $ result -> UserId ( ) ) ; $ this -> server -> WriteResponse ( new AccountActionResponse ( $ this -> server , $ result -> UserId ( ) ) , RestResponse :: CREATED_CODE ) ; } else { Log :: Debug ( 'AccountWebService.Create() - User Create Failed.' ) ; $ this -> server -> WriteResponse ( new FailedResponse ( $ this -> server , $ result -> Errors ( ) ) , RestResponse :: BAD_REQUEST_CODE ) ; } }
@name CreateAccount
 @description Creates a user account.
@name CreateAccount @description Creates a user account .
/** @var $request CreateAccountRequest */