summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/domain/sparkle.go3
-rw-r--r--app/init.go10
2 files changed, 10 insertions, 3 deletions
diff --git a/app/domain/sparkle.go b/app/domain/sparkle.go
index 2ea5a53..c9ff02a 100644
--- a/app/domain/sparkle.go
+++ b/app/domain/sparkle.go
@@ -57,7 +57,8 @@ func (s *Sparkle) ToGID() string {
func (self *Sparkle) ToObjectReference() *v1.ObjectReference {
return &v1.ObjectReference{
ObjectType: "sparkle",
- ObjectId: self.ID.String(),
+ // ObjectId: self.ID.String(),
+ ObjectId: "1",
}
}
diff --git a/app/init.go b/app/init.go
index b88cb00..581944b 100644
--- a/app/init.go
+++ b/app/init.go
@@ -2,8 +2,10 @@ package app
import (
"context"
+ "fmt"
"net/http"
"os"
+ "strings"
v1 "github.com/authzed/authzed-go/proto/authzed/api/v1"
"github.com/authzed/authzed-go/v1"
@@ -83,7 +85,7 @@ func init() {
ioc.MustResolve[*event.TypedAggregator[*domain.Sparkle]](c).SubscribeTo("after.create", func(item *domain.Sparkle) {
client := ioc.MustResolve[*authzed.Client](c)
- client.WriteRelationships(context.Background(), &v1.WriteRelationshipsRequest{
+ response, err := client.WriteRelationships(context.Background(), &v1.WriteRelationshipsRequest{
Updates: []*v1.RelationshipUpdate{
&v1.RelationshipUpdate{
Operation: v1.RelationshipUpdate_OPERATION_CREATE,
@@ -101,7 +103,7 @@ func init() {
Subject: &v1.SubjectReference{
Object: &v1.ObjectReference{
ObjectType: "user",
- ObjectId: item.Sparklee,
+ ObjectId: strings.TrimPrefix(item.Sparklee, "@"),
},
},
},
@@ -121,5 +123,9 @@ func init() {
},
},
})
+ if err != nil {
+ fmt.Printf("%v\n", err)
+ }
+ fmt.Printf("%v\n", response)
})
}