Supply access policy in grpc get realms

This commit is contained in:
LittleSheep 2024-09-17 16:54:45 +08:00
parent 4b4eb3e581
commit 7a9e31fd86

View File

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
"git.solsynth.dev/hydrogen/passport/pkg/internal/database"
"git.solsynth.dev/hydrogen/passport/pkg/internal/models"
@ -26,6 +27,7 @@ func (v *Server) ListCommunityRealm(ctx context.Context, empty *proto.ListRealmR
Description: item.Description,
IsPublic: item.IsPublic,
IsCommunity: item.IsCommunity,
AccessPolicy: hyper.EncodeAccessPolicy(item.AccessPolicy),
}
if item.Avatar != nil {
info.Avatar = *item.Avatar
@ -57,6 +59,7 @@ func (v *Server) ListAvailableRealm(ctx context.Context, request *proto.LookupUs
Description: item.Description,
IsPublic: item.IsPublic,
IsCommunity: item.IsCommunity,
AccessPolicy: hyper.EncodeAccessPolicy(item.AccessPolicy),
}
if item.Avatar != nil {
info.Avatar = *item.Avatar
@ -88,6 +91,7 @@ func (v *Server) ListOwnedRealm(ctx context.Context, request *proto.LookupUserRe
Description: item.Description,
IsPublic: item.IsPublic,
IsCommunity: item.IsCommunity,
AccessPolicy: hyper.EncodeAccessPolicy(item.AccessPolicy),
}
if item.Avatar != nil {
info.Avatar = *item.Avatar
@ -128,6 +132,7 @@ func (v *Server) GetRealm(ctx context.Context, request *proto.LookupRealmRequest
Description: realm.Description,
IsPublic: realm.IsPublic,
IsCommunity: realm.IsCommunity,
AccessPolicy: hyper.EncodeAccessPolicy(realm.AccessPolicy),
}
if realm.Avatar != nil {
info.Avatar = *realm.Avatar