@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | public function deleteAction( ServerRequestInterface $request ) |
| 34 | 34 | { |
| 35 | 35 | if( config( 'shop.authorize', true ) ) { |
| 36 | - $this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'])] ); |
|
| 36 | + $this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] ); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | return $this->createAdmin()->delete( $request, ( new Psr17Factory )->createResponse() ); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function getAction( ServerRequestInterface $request ) |
| 50 | 50 | { |
| 51 | 51 | if( config( 'shop.authorize', true ) ) { |
| 52 | - $this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'])] ); |
|
| 52 | + $this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | return $this->createAdmin()->get( $request, ( new Psr17Factory )->createResponse() ); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | public function patchAction( ServerRequestInterface $request ) |
| 66 | 66 | { |
| 67 | 67 | if( config( 'shop.authorize', true ) ) { |
| 68 | - $this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'])] ); |
|
| 68 | + $this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] ); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | return $this->createAdmin()->patch( $request, ( new Psr17Factory )->createResponse() ); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | public function postAction( ServerRequestInterface $request ) |
| 82 | 82 | { |
| 83 | 83 | if( config( 'shop.authorize', true ) ) { |
| 84 | - $this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'])] ); |
|
| 84 | + $this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] ); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | return $this->createAdmin()->post( $request, ( new Psr17Factory )->createResponse() ); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | public function putAction( ServerRequestInterface $request ) |
| 98 | 98 | { |
| 99 | 99 | if( config( 'shop.authorize', true ) ) { |
| 100 | - $this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'])] ); |
|
| 100 | + $this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] ); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | return $this->createAdmin()->put( $request, ( new Psr17Factory )->createResponse() ); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | public function optionsAction( ServerRequestInterface $request ) |
| 114 | 114 | { |
| 115 | 115 | if( config( 'shop.authorize', true ) ) { |
| 116 | - $this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'])] ); |
|
| 116 | + $this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] ); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | return $this->createAdmin()->options( $request, ( new Psr17Factory )->createResponse() ); |
@@ -309,9 +309,12 @@ |
||
| 309 | 309 | if( $userid = Auth::guard( $guard )->id() ) |
| 310 | 310 | { |
| 311 | 311 | $context->setGroupIds( function() use ( $context, $userid ) { |
| 312 | - try { |
|
| 312 | + try |
|
| 313 | + { |
|
| 313 | 314 | return \Aimeos\MShop::create( $context, 'customer' )->get( $userid, ['group'] )->getGroups(); |
| 314 | - } catch( \Exception $e ) { |
|
| 315 | + } |
|
| 316 | + catch( \Exception $e ) |
|
| 317 | + { |
|
| 315 | 318 | return []; |
| 316 | 319 | } |
| 317 | 320 | } ); |