Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit 4432ca6

Browse files
committed
grants
1 parent 73bf7e1 commit 4432ca6

10 files changed

Lines changed: 1485 additions & 32 deletions

File tree

src/Backend/Jp.Application/AutoMapper/DomainToViewModelMappingProfile.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public class DomainToViewModelMappingProfile : Profile
1515
{
1616
public DomainToViewModelMappingProfile()
1717
{
18-
CreateMap<PersistedGrant, PersistedGrantViewModel>();
1918
CreateMap<ApiResource, ApiResourceListViewModel>();
2019
CreateMap<User, UserViewModel>().ForMember(a => a.Password, o => o.Ignore()).ForMember(a => a.ConfirmPassword, o => o.Ignore());
2120
CreateMap<StoredEvent, EventHistoryData>().ConstructUsing(a => new EventHistoryData() { Action = a.MessageType, Id = a.Id.ToString(), Details = a.Data, When = a.Timestamp.ToString(CultureInfo.InvariantCulture), Who = a.User });

src/Backend/Jp.Application/Interfaces/IPersistedGrantAppService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
using System.Collections.Generic;
33
using System.Text;
44
using System.Threading.Tasks;
5+
using IdentityServer4.Models;
56
using Jp.Application.ViewModels;
67

78
namespace Jp.Application.Interfaces
89
{
910
public interface IPersistedGrantAppService: IDisposable
1011
{
11-
Task<IEnumerable<PersistedGrantViewModel>> GetPersistedGrants();
12+
Task<IEnumerable<PersistedGrant>> GetPersistedGrants();
1213
}
1314
}

src/Backend/Jp.Application/Services/PersistedGrantAppService.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
using AutoMapper;
22
using Jp.Application.Interfaces;
3-
using Jp.Application.ViewModels;
43
using Jp.Domain.Core.Bus;
54
using Jp.Domain.Interfaces;
65
using System;
76
using System.Collections.Generic;
87
using System.Linq;
98
using System.Threading.Tasks;
9+
using IdentityServer4.EntityFramework.Mappers;
10+
using IdentityServer4.Models;
1011

1112
namespace Jp.Application.Services
1213
{
@@ -28,10 +29,10 @@ public PersistedGrantAppService(IMapper mapper,
2829
_persistedGrantRepository = persistedGrantRepository;
2930
}
3031

31-
public async Task<IEnumerable<PersistedGrantViewModel>> GetPersistedGrants()
32+
public async Task<IEnumerable<PersistedGrant>> GetPersistedGrants()
3233
{
3334
var resultado = await _persistedGrantRepository.GetGrants();
34-
return resultado.Select(s => _mapper.Map<PersistedGrantViewModel>(s));
35+
return resultado.Select(s => s.ToModel());
3536
}
3637
public void Dispose()
3738
{

src/Backend/Jp.Application/ViewModels/PersistedGrantViewModel.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/Backend/Jp.UserManagement/Controllers/PersistedGrants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public PersistedGrants(
3131

3232

3333
[HttpGet, Route("list")]
34-
public async Task<ActionResult<DefaultResponse<IEnumerable<PersistedGrantViewModel>>>> List()
34+
public async Task<ActionResult<DefaultResponse<IEnumerable<PersistedGrant>>>> List()
3535
{
3636
var irs = await _persistedGrantAppService.GetPersistedGrants();
3737
return Response(irs);

src/Frontend/Jp.AdminUI/src/app/panel/persisted-grants/list/persisted-grants-list.component.html

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="content-heading">
22
<div>
3-
🔑 {{ 'general.persisted-grant' | translate }}
4-
<small><b> {{ 'persistedGrant.description' | translate }}.</b></small>
3+
🔑 {{ 'general.persisted-grants' | translate }}
4+
<small><b> {{ 'persistedGrant.description' | translate }}</b></small>
55
</div>
66
</div>
77

@@ -10,19 +10,15 @@
1010
<div class="container-fluid" *ngIf="persistedGrants">
1111
<div class="col-xl-12 col-md-12 col-lg-12">
1212
<div class="card">
13-
<div class="card-header">
14-
<a class="btn btn-outline-primary mb-3" [routerLink]="[ '/identity-resource/add' ]"><i class="fa fa-plus-circle"></i>
15-
{{ 'persistedGrant.new-grant' | translate }}</a>
16-
</div>
1713

1814
<div class="card-body">
1915
<div class="table-responsive">
2016
<table class="table table-striped">
2117
<thead>
2218
<tr>
2319
<th></th>
24-
<th> {{ "persistedGrant.list.name" | translate }}</th>
25-
<th> {{"persistedGrant.list.description" | translate }} </th>
20+
<th> {{ 'persistedGrant.list.clientId' | translate }}</th>
21+
<th> {{ 'persistedGrant.list.type' | translate }} </th>
2622
<th></th>
2723

2824
</tr>
@@ -34,11 +30,11 @@
3430
placement="top" [tooltip]="'general.edit' | translate"><i class="fa fa-edit"></i></a>
3531
&nbsp;
3632
</th>
37-
<td>{{grant.name}}</td>
38-
<td>{{grant.description}}</td>
33+
<td>{{grant.clientId}}</td>
34+
<td>{{grant.type}}</td>
3935
<td>
4036
<button class="btn btn-danger btn-xs" placement="top" [tooltip]="'general.remove' | translate"
41-
(click)="remove(grant.name)"><i class="fa fa-times"></i></button>
37+
(click)="remove(grant.key)"><i class="fa fa-times"></i></button>
4238
</td>
4339
</tr>
4440
</tbody>

src/Frontend/Jp.AdminUI/src/app/panel/persisted-grants/list/persisted-grants-list.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class PersistedGrantListComponent implements OnInit {
2828
}
2929

3030
public remove(name: string) {
31-
this.translator.translate.get('persisttedGrant.remove').subscribe(m => {
31+
this.translator.translate.get('persistedGrant.remove').subscribe(m => {
3232
swal({
3333
title: m['title'],
3434
text: m["text"],
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
11
export class PersistedGrant {
2+
/// <summary>
3+
/// Gets or sets the key.
4+
/// </summary>
5+
/// <value>
6+
/// The key.
7+
/// </value>
8+
public key: string;
29

10+
/// <summary>
11+
/// Gets the type.
12+
/// </summary>
13+
/// <value>
14+
/// The type.
15+
/// </value>
16+
public type: string;
17+
18+
/// <summary>
19+
/// Gets the subject identifier.
20+
/// </summary>
21+
/// <value>
22+
/// The subject identifier.
23+
/// </value>
24+
public subjectId: string;
25+
26+
/// <summary>
27+
/// Gets the client identifier.
28+
/// </summary>
29+
/// <value>
30+
/// The client identifier.
31+
/// </value>
32+
public clientId: string;
33+
34+
/// <summary>
35+
/// Gets or sets the creation time.
36+
/// </summary>
37+
/// <value>
38+
/// The creation time.
39+
/// </value>
40+
public creationTime: string;
41+
42+
/// <summary>
43+
/// Gets or sets the expiration.
44+
/// </summary>
45+
/// <value>
46+
/// The expiration.
47+
/// </value>
48+
public expiration: string;
49+
50+
/// <summary>
51+
/// Gets or sets the data.
52+
/// </summary>
53+
/// <value>
54+
/// The data.
55+
/// </value>
56+
public data: string;
357
}

src/Frontend/Jp.AdminUI/src/assets/i18n/en.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,11 @@
268268
"expiration": "Expiration",
269269
"expiration-tooltip": "Set expiration"
270270
},
271-
"persisted-grants": {
271+
"persistedGrant": {
272+
"description": "",
272273
"list": {
273-
"name": "Name",
274-
"description": "Description"
274+
"clientId": "Client",
275+
"type": "Type"
275276
}
276277
},
277278
"toasterMessages": {
@@ -291,7 +292,6 @@
291292
"api-resource": "Protected Resources",
292293
"persisted-grants": "Persisted Grants",
293294
"users": "Users",
294-
"roles": "Roles",
295-
"persisted-grant": ""
295+
"roles": "Roles"
296296
}
297297
}

0 commit comments

Comments
 (0)