Skip to content

Commit 865cb24

Browse files
committed
refactor: add owner-only actions for managing trusted verifiers in renderer
1 parent 6cd9afc commit 865cb24

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/r/karma1337/geo-resto/renderer.gno

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"strconv"
55
"strings"
66
"time"
7+
8+
"chain/runtime"
79
)
810

911
// Renderer handles the display and formatting of geographic data for web interface
@@ -48,6 +50,16 @@ func (r *Renderer) RenderMainPage() string {
4850
createEventGenericLink := GetCreateEventTxLink("", "", "", 0, 0, 0)
4951
sb.WriteString("- [🎯 Create Event](" + createEventGenericLink + ")\n\n")
5052

53+
// Owner-only actions: add/remove trusted verifiers
54+
// Use runtime.PreviousRealm() to detect the current caller for the web UI.
55+
caller := runtime.PreviousRealm().Address()
56+
if authManager.IsAdmin(caller.String()) {
57+
addTrusted := GetAddTrustedVerifierTxLink("")
58+
removeTrusted := GetRemoveTrustedVerifierTxLink("")
59+
sb.WriteString("- [🔐 Add Trusted Verifier](" + addTrusted + ") (owner only)\n\n")
60+
sb.WriteString("- [🔓 Remove Trusted Verifier](" + removeTrusted + ") (owner only)\n\n")
61+
}
62+
5163
// Recent activity
5264
sb.WriteString("## 🔥 Recent Activity\n")
5365
recentVisits := visitManager.GetRecentVisits(5)
@@ -308,6 +320,15 @@ func (r *Renderer) RenderEvent(eventID string) string {
308320
verifyLink := GetVerifyPresenceTxLink(event.ID, "", "")
309321
sb.WriteString("- [✅ Verify Attendee (organizer)](" + verifyLink + ")\n\n")
310322

323+
// Owner-only: add/remove trusted verifier links (prefill target addr with owner as a convenience)
324+
caller := runtime.PreviousRealm().Address()
325+
if authManager.IsAdmin(caller.String()) {
326+
addTrusted := GetAddTrustedVerifierTxLink(caller.String())
327+
removeTrusted := GetRemoveTrustedVerifierTxLink(caller.String())
328+
sb.WriteString("- [🔐 Add Trusted Verifier](" + addTrusted + ") (owner only)\n\n")
329+
sb.WriteString("- [🔓 Remove Trusted Verifier](" + removeTrusted + ") (owner only)\n\n")
330+
}
331+
311332
// Verification Statistics
312333
totalParticipants := len(event.Participants)
313334
verifiedCount := len(event.VerifiedAttendees)

0 commit comments

Comments
 (0)