diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/db/authorization.go | 9 | ||||
| -rw-r--r-- | app/domain/user.go | 4 |
2 files changed, 4 insertions, 9 deletions
diff --git a/app/db/authorization.go b/app/db/authorization.go index 3041f51..ec8e47b 100644 --- a/app/db/authorization.go +++ b/app/db/authorization.go @@ -108,14 +108,5 @@ func (r *authorization[T]) Save(ctx context.Context, item T) error { func (r *authorization[T]) subjectFrom(ctx context.Context) *v1.SubjectReference { currentUser := cfg.CurrentUser.From(ctx) - if currentUser == nil { - return &v1.SubjectReference{ - Object: &v1.ObjectReference{ - ObjectType: "user", - ObjectId: "*", - }, - } - } - return currentUser.ToSubjectReference() } diff --git a/app/domain/user.go b/app/domain/user.go index 198fafc..97bacdd 100644 --- a/app/domain/user.go +++ b/app/domain/user.go @@ -2,6 +2,7 @@ package domain import ( v1 "github.com/authzed/authzed-go/proto/authzed/api/v1" + "github.com/xlgmokha/x/pkg/x" ) type User struct { @@ -33,6 +34,9 @@ func (self *User) Sparkle(sparklee string, reason string) *Sparkle { } func (self *User) ToGID() GlobalID { + if x.IsZero(self.Username) { + return GlobalID("gid://sparkle/User/*") + } return GlobalID("gid://sparkle/User/" + self.Username) } |
