[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[reclaim-ui] 75/459: ticket list fixed attributes and added revoke confi
From: |
gnunet |
Subject: |
[reclaim-ui] 75/459: ticket list fixed attributes and added revoke confirmation |
Date: |
Fri, 11 Jun 2021 23:22:47 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository reclaim-ui.
commit 3e8dc2aa27c0d71b1bed94c1ffb4e9c22f1ef0ff
Author: Alexia Pagkopoulou <a.pagkopoulou@tum.de>
AuthorDate: Fri Jun 7 13:14:55 2019 +0200
ticket list fixed attributes and added revoke confirmation
---
src/app/identity-list/identity-list.component.html | 17 ++++++--
src/app/identity-list/identity-list.component.ts | 48 +++++++++++++++++-----
src/app/namestore.service.ts | 4 ++
3 files changed, 55 insertions(+), 14 deletions(-)
diff --git a/src/app/identity-list/identity-list.component.html
b/src/app/identity-list/identity-list.component.html
index 20e164a..af8d7a9 100644
--- a/src/app/identity-list/identity-list.component.html
+++ b/src/app/identity-list/identity-list.component.html
@@ -116,13 +116,24 @@
</td>
<td>
<div style="min-width: 15em">
- {{showSharedAttributes(ticket)}}
+ {{ticketAttributeMapper[ticket.audience]}}
</div>
</td>
<td>
+
+
+ <button class="btn btn-primary" *ngIf="showConfirmRevoke !=
ticket" (click)="confirmRevoke(ticket)">
+ <span class="fa fa-unlink"></span> Revoke
+ </button>
+ <div class="alert alert-danger fade show"
*ngIf="showConfirmRevoke == ticket">
+ Do you really want to revoke this ticket?<br/><br/>
<button class="btn btn-primary"
(click)="revokeTicket(identityInEdit, ticket)">
<span class="fa fa-unlink"></span> Revoke
</button>
+ <button class="btn btn-primary" (click)="hideConfirmRevoke()">
+ <span class="fa fa-close"></span> Cancel
+ </button>
+ </div>
</td>
</tr>
</tbody>
@@ -146,11 +157,11 @@
<div class="card-avatar card-img-top">
<div class="card-avatar-character text-dark">
<div class="icon m-1 text-uppercase"
[style.background-color]="intToRGB(identity.pubkey)">{{ identity.name[0]}}</div>
- <span class="m-1" styl="display: inline-block">{{
identity.name}}</span>
+ <span class="m-1" styl="display: inline-block">{{identity.name}}</span>
<button class="btn btn-primary" *ngIf="showConfirmDelete != identity"
(click)="confirmDelete(identity)">
<span class="fa fa-trash"></span>
</button>
- <button class="btn btn-primary" *ngIf="showConfirmDelete !=
identity" (click)="editIdentity(identity)">
+ <button class="btn btn-primary" *ngIf="showConfirmDelete != identity"
(click)="editIdentity(identity)">
<span class="fa fa-edit"></span>
</button>
</div>
diff --git a/src/app/identity-list/identity-list.component.ts
b/src/app/identity-list/identity-list.component.ts
index 96e74ef..ec91100 100644
--- a/src/app/identity-list/identity-list.component.ts
+++ b/src/app/identity-list/identity-list.component.ts
@@ -34,7 +34,9 @@ export class IdentityListComponent implements OnInit {
identityNameMapper: any;
showTicketsIdentity: Identity;
showConfirmDelete: any;
+ showConfirmRevoke: any;
connected: any;
+ ticketAttributeMapper: any;
constructor(private route: ActivatedRoute, private router: Router,
private oidcService: OpenIdService,
@@ -51,11 +53,13 @@ export class IdentityListComponent implements OnInit {
this.tickets = {};
this.identities = [];
this.showConfirmDelete = null;
+ this.showConfirmRevoke = null;
this.newAttribute = new Attribute ('', '', '', 'STRING');
this.requestedAttributes = {};
this.missingAttributes = {};
this.clientName = "-";
this.connected = false;
+ this.ticketAttributeMapper = {};
this.oidcService.parseRouteParams(this.route.snapshot.queryParams);
// On opening the options page, fetch stored settings and update the UI
with
// them.
@@ -109,7 +113,11 @@ export class IdentityListComponent implements OnInit {
confirmDelete(identity) { this.showConfirmDelete = identity; }
+ confirmRevoke(ticket) { this.showConfirmRevoke = ticket; }
+
hideConfirmDelete() { this.showConfirmDelete = null; }
+
+ hideConfirmRevoke() { this.showConfirmRevoke = null; }
getClientName()
{
@@ -228,8 +236,26 @@ export class IdentityListComponent implements OnInit {
this.identityNameMapper[ticket.audience] = records.data[i].value;
break;
}
- },
- error => console.debug(error.message));
+ });
+ }
+
+ private mapAttributes(identity, ticket)
+ {
+ this.namestoreService.getNames(identity).subscribe(names => {
+ this.ticketAttributeMapper[ticket.audience] = [];
+ names = names.filter(name => name.record_name ===
ticket.rnd.toLowerCase());
+ for (var i = 0; i < names.length; i++) {
+ names[i].data.forEach(record => {
+ if (record.record_type === 'RECLAIM_ATTR_REF') {
+ this.attributes[identity.pubkey]
+ .filter(attr => attr.id === record.value)
+ .map(attr => {
+ this.ticketAttributeMapper[ticket.audience].push(attr.name);
+ });
+ }
+ });
+ }
+ });
}
private updateTickets(identity)
@@ -240,7 +266,10 @@ export class IdentityListComponent implements OnInit {
return;
}
this.tickets[identity.pubkey] = tickets;
- tickets.forEach(ticket => this.mapAudience(ticket));
+ tickets.forEach(ticket => {
+ this.mapAudience(ticket);
+ this.mapAttributes(identity, ticket);
+ });
});
}
@@ -256,7 +285,10 @@ export class IdentityListComponent implements OnInit {
revokeTicket(identity, ticket)
{
this.reclaimService.revokeTicket(ticket).subscribe(
- data => { this.updateTickets(identity); });
+ data => {
+ this.updateAttributes(identity);
+ this.updateTickets(identity);
+ });
}
@@ -280,12 +312,6 @@ export class IdentityListComponent implements OnInit {
});
}
- showSharedAttributes(ticket)
- {
- return ["attr1", "attr2"];
- //TODO
- }
-
saveAttribute(identity, attribute)
{
return this.reclaimService.addAttribute(identity, attribute)
@@ -511,5 +537,5 @@ export class IdentityListComponent implements OnInit {
isConnected() {
return this.connected;
- }
+ }
}
diff --git a/src/app/namestore.service.ts b/src/app/namestore.service.ts
index 21a4939..2157098 100644
--- a/src/app/namestore.service.ts
+++ b/src/app/namestore.service.ts
@@ -10,6 +10,10 @@ export class NamestoreService {
constructor(private http: HttpClient, private config: ConfigService) { }
+ getNames(identity) {
+ return this.http.get<any>(this.config.get().apiUrl + '/namestore/' +
identity.name);
+ }
+
deleteName(identity: Identity, name: string) {
return this.http.delete(this.config.get().apiUrl + '/namestore/?label=' +
name + "&name=" + identity.name);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [reclaim-ui] 83/459: prevent authorization on unverified clients, (continued)
- [reclaim-ui] 83/459: prevent authorization on unverified clients, gnunet, 2021/06/11
- [reclaim-ui] 60/459: update dependencies, gnunet, 2021/06/11
- [reclaim-ui] 71/459: change authz request, gnunet, 2021/06/11
- [reclaim-ui] 85/459: fix client name check #2, gnunet, 2021/06/11
- [reclaim-ui] 87/459: fix client name check #4, gnunet, 2021/06/11
- [reclaim-ui] 64/459: update deps, gnunet, 2021/06/11
- [reclaim-ui] 90/459: clarify state, gnunet, 2021/06/11
- [reclaim-ui] 94/459: minor, gnunet, 2021/06/11
- [reclaim-ui] 93/459: update ui, gnunet, 2021/06/11
- [reclaim-ui] 88/459: prettify information, gnunet, 2021/06/11
- [reclaim-ui] 75/459: ticket list fixed attributes and added revoke confirmation,
gnunet <=
- [reclaim-ui] 91/459: fix html, gnunet, 2021/06/11
- [reclaim-ui] 89/459: actually display info, gnunet, 2021/06/11
- [reclaim-ui] 96/459: openid logo fix, gnunet, 2021/06/11
- [reclaim-ui] 84/459: fix client name check, gnunet, 2021/06/11
- [reclaim-ui] 105/459: add reclaim watermark, gnunet, 2021/06/11
- [reclaim-ui] 92/459: layout fixes, gnunet, 2021/06/11
- [reclaim-ui] 81/459: identity card, gnunet, 2021/06/11
- [reclaim-ui] 97/459: open id logo: removed float altogether, gnunet, 2021/06/11
- [reclaim-ui] 98/459: openid hotfix, gnunet, 2021/06/11
- [reclaim-ui] 118/459: add unkown name, gnunet, 2021/06/11