Fixed error on adding endpoint (Admin UI)

adding endpoint feature was erroring
bc the controller was expecting that service layer
were returning a entity, intead void was returned
now its fixed.

Change-Id: Icdb3e12a9e644555d006c00cb3db1a3593f628f2
This commit is contained in:
Sebastian Marcet 2017-01-18 17:57:53 -03:00
parent 83b4c3236b
commit 3979961668
8 changed files with 55 additions and 30 deletions

View File

@ -443,9 +443,9 @@ final class UserController extends OpenIdController
public function postUserProfileOptions()
{
$show_full_name = Input::get("show_full_name");
$show_email = Input::get("show_email");
$show_pic = Input::get("show_pic");
$show_full_name = intval(Input::get("show_full_name", 0));
$show_email = intval(Input::get("show_email", 0));
$show_pic = intval(Input::get("show_pic", 0));
$user = $this->auth_service->getCurrentUser();
$this->user_service->saveProfileInfo($user->getId(), $show_pic, $show_full_name, $show_email);

View File

@ -42,14 +42,11 @@ final class RepositoriesProvider extends ServiceProvider
App::singleton(\OpenId\Repositories\IOpenIdTrustedSiteRepository::class, \Repositories\EloquentOpenIdTrustedSiteRepository::class);
App::singleton(\Auth\Repositories\IUserRepository::class, function(){
return new CacheUserRepository
(
new EloquentUserRepository
return new EloquentUserRepository
(
new User(),
App::make(UtilsServiceCatalog::LogService)
)
);
);
});
App::singleton(\Auth\Repositories\IMemberRepository::class, \Repositories\EloquentMemberRepository::class);
@ -57,36 +54,33 @@ final class RepositoriesProvider extends ServiceProvider
App::singleton(\OAuth2\Repositories\IServerPrivateKeyRepository::class, \Repositories\EloquentServerPrivateKeyRepository::class);
App::singleton(\OAuth2\Repositories\IClientRepository::class, function(){
return new CacheClientRepository(
new EloquentClientRepository(new Client(), App::make(UtilsServiceCatalog::LogService))
);
return new EloquentClientRepository(new Client(), App::make(UtilsServiceCatalog::LogService));
});
App::singleton(\OAuth2\Repositories\IResourceServerRepository::class, function(){
return new CacheResourceServerRepository(new EloquentResourceServerRepository(new ResourceServer()));
return new EloquentResourceServerRepository(new ResourceServer());
});
App::singleton(\Models\IWhiteListedIPRepository::class, function (){
return new CacheWhiteListedIPRepository(new EloquentWhiteListedIPRepository(new WhiteListedIP()));
return new EloquentWhiteListedIPRepository(new WhiteListedIP());
});
App::singleton(\OAuth2\Repositories\IApiRepository::class, function(){
return new CacheApiRepository(new EloquentApiRepository(new Api()));
return new EloquentApiRepository(new Api());
});
App::singleton(\OAuth2\Repositories\IApiScopeRepository::class, function(){
return new CacheApiScopeRepository(new EloquentApiScopeRepository(new ApiScope()));
return new EloquentApiScopeRepository(new ApiScope());
});
App::singleton(\OAuth2\Repositories\IApiEndpointRepository::class, function(){
return new CacheApiEndpointRepository(new EloquentApiEndpointRepository(new ApiEndpoint()));
return new EloquentApiEndpointRepository(new ApiEndpoint());
});
App::singleton(\OAuth2\Repositories\IApiScopeGroupRepository::class, \Repositories\EloquentApiScopeGroupRepository::class);
App::singleton(\OAuth2\Repositories\IRefreshTokenRepository::class, function(){
return new CacheRefreshTokenRepository
(
return new CacheRefreshTokenRepository(
new EloquentRefreshTokenRepository
(
new RefreshToken(),
@ -96,16 +90,19 @@ final class RepositoriesProvider extends ServiceProvider
});
App::singleton(\OAuth2\Repositories\IAccessTokenRepository::class, function(){
return new CacheAccessTokenRepository
(
new EloquentAccessTokenRepository
return new CacheAccessTokenRepository
(
new AccessToken(),
App::make(UtilsServiceCatalog::LogService)
)
);
new EloquentAccessTokenRepository
(
new AccessToken(),
App::make(UtilsServiceCatalog::LogService)
)
);
});
// https://laravel.com/docs/5.2/container#contextual-binding
//App::when(AdminController::class)->needs()
}
public function provides()

View File

@ -106,6 +106,8 @@ class ApiEndpointService implements IApiEndpointService {
);
$this->repository->add($instance);
return $instance;
});
}

View File

@ -192,24 +192,36 @@ class User extends BaseModelEloquent implements AuthenticatableContract, IOpenId
return (int)$this->id;
}
/**
* @return bool
*/
public function getShowProfileFullName()
{
return $this->public_profile_show_fullname;
return $this->public_profile_show_fullname > 0 ;
}
/**
* @return bool
*/
public function getShowProfilePic()
{
return $this->public_profile_show_photo;
return $this->public_profile_show_photo > 0;
}
/**
* @return bool
*/
public function getShowProfileBio()
{
return false;
}
/**
* @return bool
*/
public function getShowProfileEmail()
{
return $this->public_profile_show_email;
return $this->public_profile_show_email > 0;
}
public function getBio()

View File

@ -88,12 +88,24 @@ interface IOpenIdUser
public function getDateOfBirth();
/**
* @return bool
*/
public function getShowProfileFullName();
/**
* @return bool
*/
public function getShowProfilePic();
/**
* @return bool
*/
public function getShowProfileBio();
/**
* @return bool
*/
public function getShowProfileEmail();
public function getBio();

View File

@ -9,7 +9,8 @@ jQuery(document).ready(function($){
"name" : {required: true, nowhitespace:true,rangelength: [1, 255]},
"description":{required: true, free_text:true,rangelength: [1, 1024]},
"route": {required: true, endpointroute:true,rangelength: [1, 1024]},
"rate_limit": {required: true, number:true}
"rate_limit": {required: true, number:true},
"http_method": {required: true}
}
});

View File

@ -37,7 +37,7 @@
<label for="http_method">HTTP Method&nbsp;<span aria-hidden="true"
class="glyphicon glyphicon-info-sign pointable"
title=''></span></label>
{!! Form::select('http_method', array('GET' => 'GET', 'POST' => 'POST', 'PUT' => 'PUT', 'DELETE' => 'DELETE'), $endpoint->http_method,array('class' => 'form-control', 'id' => 'http_method')); !!}
{!! Form::select('http_method', array('GET' => 'GET', 'POST' => 'POST', 'PUT' => 'PUT', 'DELETE' => 'DELETE'), $endpoint->http_method, array('class' => 'form-control', 'id' => 'http_method')); !!}
</div>
<div class="checkbox">
<label>

View File

@ -27,6 +27,7 @@
<option value="GET">GET</option>
<option value="POST">POST</option>
<option value="PUT">PUT</option>
<option value="PUT">PATCH</option>
<option value="DELETE">DELETE</option>
</select>
</div>