Browse Source

Merge "Fixed Scope Groups Update"

tags/2.0.1
Zuul 1 month ago
parent
commit
e83daebda0

+ 10
- 11
app/Http/Controllers/Api/ApiScopeGroupController.php View File

@@ -202,25 +202,24 @@ final class ApiScopeGroupController extends AbstractRESTController implements IC
202 202
 
203 203
             $values = Input::all();
204 204
 
205
-            $rules = array
206
-            (
207
-                'id'     => 'required|integer',
205
+            $rules = [
206
+               'id'     => 'required|integer',
208 207
                 'name'   => 'required|text|max:512',
209 208
                 'active' => 'required|boolean',
210 209
                 'scopes' => 'required',
211 210
                 'users'  => 'required|user_ids',
212
-            );
211
+            ];
213 212
             // Creates a Validator instance and validates the data.
214 213
             $validation = Validator::make($values, $rules);
215 214
             if ($validation->fails()) {
216 215
                 $messages = $validation->messages()->toArray();
217 216
 
218
-                return $this->error400(array('error' => 'validation', 'messages' => $messages));
217
+                return $this->error400(['error' => 'validation', 'messages' => $messages]);
219 218
             }
220 219
 
221
-            $res = $this->service->update(intval($values['id']), $values);
220
+            $this->service->update(intval($values['id']), $values);
222 221
 
223
-            return $res ? $this->ok() : $this->error400(array('error' => 'operation failed'));
222
+            return $this->ok();
224 223
         }
225 224
         catch (InvalidApiScopeGroup $ex1)
226 225
         {
@@ -236,8 +235,8 @@ final class ApiScopeGroupController extends AbstractRESTController implements IC
236 235
     public function activate($id){
237 236
         try
238 237
         {
239
-            $res = $this->service->setStatus($id, true);
240
-            return $res?$this->ok():$this->error400(array('error'=>'operation failed'));
238
+            $this->service->setStatus($id, true);
239
+            return $this->ok();
241 240
         }
242 241
         catch (Exception $ex) {
243 242
             $this->log_service->error($ex);
@@ -248,8 +247,8 @@ final class ApiScopeGroupController extends AbstractRESTController implements IC
248 247
     public function deactivate($id){
249 248
         try
250 249
         {
251
-            $res = $this->service->setStatus($id, false);
252
-            return $res?$this->ok():$this->error400(array('error'=>'operation failed'));
250
+            $this->service->setStatus($id, false);
251
+            return $this->ok();
253 252
         }
254 253
         catch (Exception $ex) {
255 254
             $this->log_service->error($ex);

+ 0
- 1
app/Http/Controllers/Api/ClientApiController.php View File

@@ -240,7 +240,6 @@ final class ClientApiController extends AbstractRESTController implements ICRUDC
240 240
                 'policy_uri'                      => 'sometimes|required|url',
241 241
                 'jwks_uri'                        => 'sometimes|required|url',
242 242
                 'default_max_age'                 => 'sometimes|required|integer',
243
-                'logout_use_iframe'               => 'sometimes|required|boolean',
244 243
                 'require_auth_time'               => 'sometimes|required|boolean',
245 244
                 'token_endpoint_auth_method'      => 'sometimes|required|token_endpoint_auth_method',
246 245
                 'token_endpoint_auth_signing_alg' => 'sometimes|required|signing_alg',

+ 1
- 1
app/Services/OAuth2/ApiScopeGroupService.php View File

@@ -112,7 +112,7 @@ final class ApiScopeGroupService implements IApiScopeGroupService
112 112
                     }
113 113
                     if($param === 'scopes')
114 114
                     {
115
-                        $ids = $group->scopes()->getRelatedIds()->all();
115
+                        $ids = $group->scopes()->pluck('id')->all();
116 116
                         $group->scopes()->detach($ids);
117 117
                         $scopes = explode(',', $params['scopes']);
118 118
                         foreach($scopes as $scope_id)

+ 2
- 1
app/libs/OAuth2/Models/AuthorizationCode.php View File

@@ -184,7 +184,8 @@ class AuthorizationCode extends Token
184 184
         $value,
185 185
         $user_id,
186 186
         $client_id,
187
-        $scope,$audience           = '',
187
+        $scope,
188
+        $audience                  = '',
188 189
         $redirect_uri              = null,
189 190
         $issued                    = null,
190 191
         $lifetime                  = 600,

+ 1
- 0
app/libs/Utils/Http/HttpResponse.php View File

@@ -23,6 +23,7 @@ abstract class HttpResponse extends HttpMessage
23 23
      */
24 24
     public function __construct($http_code, $content_type)
25 25
     {
26
+        parent::__construct();
26 27
         $this->http_code    = $http_code;
27 28
         $this->content_type = $content_type;
28 29
     }

+ 3
- 4
database/seeds/ApiSeeder.php View File

@@ -20,10 +20,9 @@ class ApiSeeder extends Seeder {
20 20
         // users
21 21
         Api::create(
22 22
             array(
23
-                'name'            => 'users',
24
-                'logo'            =>  null,
25
-                'active'          =>  true,
26
-                'Description'     => 'User Info',
23
+                'name'               => 'users',
24
+                'active'             =>  true,
25
+                'Description'        => 'User Info',
27 26
                 'resource_server_id' => $resource_server->id,
28 27
                 'logo'               => asset('/assets/img/apis/server.png')
29 28
             )

+ 0
- 1
tests/OAuth2ProtocolTest.php View File

@@ -654,7 +654,6 @@ final class OAuth2ProtocolTest extends OpenStackIDBaseTest
654 654
             $params = array(
655 655
                 'refresh_token' => $refresh_token,
656 656
                 'grant_type' => OAuth2Protocol::OAuth2Protocol_GrantType_RefreshToken,
657
-                'grant_type' => OAuth2Protocol::OAuth2Protocol_GrantType_RefreshToken,
658 657
             );
659 658
 
660 659
             $response = $this->action("POST", "OAuth2\OAuth2ProviderController@token",

Loading…
Cancel
Save