Browse Source

Fixed bug on grants pagination

when user starts to paginate, application
type field disapperead and was populated with
created_at field instead.

Change-Id: I59bc728dd7e4161d1ef2f60821f038df2c161fc6
Sebastian Marcet 1 year ago
parent
commit
34ffcd1d5a

+ 0
- 33
app/Console/Commands/Inspire.php View File

@@ -1,33 +0,0 @@
1
-<?php
2
-
3
-namespace App\Console\Commands;
4
-
5
-use Illuminate\Console\Command;
6
-use Illuminate\Foundation\Inspiring;
7
-
8
-class Inspire extends Command
9
-{
10
-    /**
11
-     * The name and signature of the console command.
12
-     *
13
-     * @var string
14
-     */
15
-    protected $signature = 'inspire';
16
-
17
-    /**
18
-     * The console command description.
19
-     *
20
-     * @var string
21
-     */
22
-    protected $description = 'Display an inspiring quote';
23
-
24
-    /**
25
-     * Execute the console command.
26
-     *
27
-     * @return mixed
28
-     */
29
-    public function handle()
30
-    {
31
-        $this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
32
-    }
33
-}

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

@@ -669,6 +669,7 @@ final class ClientApiController extends AbstractRESTController implements ICRUDC
669 669
 
670 670
             foreach ($paginator->items() as $token) {
671 671
                 $res[] =  [
672
+                    'app_type' => $token->client()->first()->getFriendlyApplicationType(),
672 673
                     'value'    => $token->value,
673 674
                     'scope'    => $token->scope,
674 675
                     'lifetime' => $token->getRemainingLifetime(),
@@ -706,6 +707,7 @@ final class ClientApiController extends AbstractRESTController implements ICRUDC
706 707
 
707 708
             foreach ($paginator->items() as $token) {
708 709
                 $res[] = [
710
+                    'app_type' => $token->client()->first()->getFriendlyApplicationType(),
709 711
                     'value'    => $token->value,
710 712
                     'scope'    => $token->scope,
711 713
                     'lifetime' => $token->getRemainingLifetime(),

+ 12
- 10
public/assets/js/oauth2/profile/edit-user-grants.js View File

@@ -20,14 +20,15 @@ function updateAccessTokenList(page, page_size){
20 20
             else{
21 21
                 $('#info-access-tokens').hide();
22 22
                 $('#table-access-tokens').show();
23
-                var template   = $('<tbody><tr><td class="issued"></td><td class="scope"></td><td class="lifetime"></td><td><a title="Revoke Access Token" class="btn btn-default btn-md active btn-delete revoke-token revoke-access-token" data-hint="access-token">Revoke</a></td></tr></tbody>');
23
+                var template   = $('<tbody><tr><td class="app_type"></td><td class="issued"></td><td class="scope"></td><td class="lifetime"></td><td><a title="Revoke Access Token" class="btn btn-default btn-md active btn-delete revoke-token revoke-access-token" data-hint="access-token">Revoke</a></td></tr></tbody>');
24 24
                 var directives = {
25 25
                     'tr':{
26 26
                         'token<-context':{
27
-                            '@id'        :'token.value',
28
-                            'td.issued'  :'token.issued',
29
-                            'td.scope'   :'token.scope',
30
-                            'td.lifetime':'token.lifetime',
27
+                            '@id'         :'token.value',
28
+                            'td.app_type' :'token.app_type',
29
+                            'td.issued'   :'token.issued',
30
+                            'td.scope'    :'token.scope',
31
+                            'td.lifetime' :'token.lifetime',
31 32
                             'a@href':function(arg){
32 33
                                 var token_value = arg.item.value;
33 34
                                 var href = TokensUrls.AccessTokenUrls.delete;
@@ -71,14 +72,15 @@ function updateRefreshTokenList(page, page_size){
71 72
             else{
72 73
                 $('#info-refresh-tokens').hide();
73 74
                 $('#table-refresh-tokens').show();
74
-                var template   = $('<tbody><tr><td class="issued"></td><td class="scope"></td><td class="lifetime"></td><td><a title="Revoke Refresh Token" class="btn btn-default btn-md active btn-delete revoke-token revoke-refresh-token" data-hint="refresh-token">Revoke</a></td></tr></tbody>');
75
+                var template   = $('<tbody><tr><td class="app_type"></td><td class="issued"></td><td class="scope"></td><td class="lifetime"></td><td><a title="Revoke Refresh Token" class="btn btn-default btn-md active btn-delete revoke-token revoke-refresh-token" data-hint="refresh-token">Revoke</a></td></tr></tbody>');
75 76
                 var directives = {
76 77
                     'tr':{
77 78
                         'token<-context':{
78
-                            '@id'        :'token.value',
79
-                            'td.issued'  :'token.issued',
80
-                            'td.scope'   :'token.scope',
81
-                            'td.lifetime':function(arg){
79
+                            '@id'         :'token.value',
80
+                            'td.app_type' :'token.app_type',
81
+                            'td.issued'   :'token.issued',
82
+                            'td.scope'    :'token.scope',
83
+                            'td.lifetime' : function(arg){
82 84
                                 var token_lifetime = arg.item.lifetime;
83 85
                                 return token_lifetime===0?'Not Expire':token_lifetime;
84 86
                             },

+ 4
- 0
resources/views/oauth2/profile/edit-user-grants.blade.php View File

@@ -21,6 +21,7 @@
21 21
                     <thead>
22 22
                     <tr>
23 23
                         <th>Application Type</th>
24
+                        <th>Issued</th>
24 25
                         <th>Application Name</th>
25 26
                         <th>Granted Scopes</th>
26 27
                         <th>&nbsp;</th>
@@ -30,6 +31,7 @@
30 31
                     @foreach($access_tokens as $access_token)
31 32
                         <tr id="{!!$access_token->value!!}">
32 33
                             <td>{!!$access_token->client()->first()->getFriendlyApplicationType()!!}</td>
34
+                            <td>{!!$access_token->created_at!!}</td>
33 35
                             <td>{!!$access_token->client()->first()->app_name!!}</td>
34 36
                             <td>{!!$access_token->scope!!}</td>
35 37
                             <td>{!! HTML::link(URL::action("Api\\UserApiController@revokeToken",array("id"=>$user_id,"value"=>$access_token->value, "hint"=>'access-token')),'Revoke Access',array('data-value' => $access_token->value,'data-hint'=>'access-token','class'=>'btn btn-default btn-md active btn-delete revoke-token','title'=>'Revoke Access Token')) !!}</td>
@@ -64,6 +66,7 @@
64 66
                     <thead>
65 67
                     <tr>
66 68
                         <th>Application Type</th>
69
+                        <th>Issued</th>
67 70
                         <th>Application Name</th>
68 71
                         <th>Granted Scopes</th>
69 72
                         <th>&nbsp;</th>
@@ -73,6 +76,7 @@
73 76
                     @foreach($refresh_tokens as $refresh_token)
74 77
                         <tr id="{!!$refresh_token->value!!}">
75 78
                             <td>{!!$refresh_token->client()->first()->getFriendlyApplicationType()!!}</td>
79
+                            <td>{!!$refresh_token->created_at!!}</td>
76 80
                             <td>{!!$refresh_token->client()->first()->app_name!!}</td>
77 81
                             <td>{!!$refresh_token->scope!!}</td>
78 82
                             <td>{!! HTML::link(URL::action("Api\\UserApiController@revokeToken",array("id" => $user_id,"value" => $refresh_token->value, "hint" => 'refresh-token')),'Revoke Access',array('data-value' => $refresh_token->value,'data-hint' => 'refresh_token','class' => 'btn btn-default btn-md active btn-delete revoke-token','title' => 'Revoke Access Token')) !!}</td>

Loading…
Cancel
Save