diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 7ea6a31..01a6b03 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,13 +4,13 @@
-
+
+
+
-
-
-
-
+
+
@@ -33,10 +33,10 @@
-
-
+ {}
+ {
+ "isMigrated": true
+}
@@ -162,7 +162,6 @@
-
@@ -187,7 +186,8 @@
-
+
+
diff --git a/pkg/authkit/audit.go b/pkg/authkit/audit.go
index 32e2ebc..62ecf55 100644
--- a/pkg/authkit/audit.go
+++ b/pkg/authkit/audit.go
@@ -1,6 +1,7 @@
package authkit
import (
+ "context"
"fmt"
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
@@ -13,7 +14,7 @@ func AddEvent(nx *nex.Conn, userId uint, action, target, ip, ua string) error {
if err != nil {
return fmt.Errorf("failed to get auth service client: %v", err)
}
- _, err = proto.NewAuditServiceClient(conn).RecordEvent(nil, &proto.RecordEventRequest{
+ _, err = proto.NewAuditServiceClient(conn).RecordEvent(context.Background(), &proto.RecordEventRequest{
UserId: uint64(userId),
Action: action,
Target: target,
@@ -33,7 +34,7 @@ func AddEventExt(nx *nex.Conn, action, target string, c *fiber.Ctx) error {
if err != nil {
return fmt.Errorf("failed to get auth service client: %v", err)
}
- _, err = proto.NewAuditServiceClient(conn).RecordEvent(nil, &proto.RecordEventRequest{
+ _, err = proto.NewAuditServiceClient(conn).RecordEvent(context.Background(), &proto.RecordEventRequest{
UserId: uint64(user.ID),
Action: action,
Target: target,
diff --git a/pkg/authkit/notify.go b/pkg/authkit/notify.go
index 3ff5dc0..aa2219e 100644
--- a/pkg/authkit/notify.go
+++ b/pkg/authkit/notify.go
@@ -1,6 +1,7 @@
package authkit
import (
+ "context"
"fmt"
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"git.solsynth.dev/hypernet/passport/pkg/proto"
@@ -17,7 +18,7 @@ func NotifyUser(nx *nex.Conn, userId uint64, notify pushkit.Notification, unsave
if len(unsaved) == 0 {
unsaved = append(unsaved, false)
}
- _, err = proto.NewNotifyServiceClient(conn).NotifyUser(nil, &proto.NotifyUserRequest{
+ _, err = proto.NewNotifyServiceClient(conn).NotifyUser(context.Background(), &proto.NotifyUserRequest{
UserId: userId,
Notify: &proto.NotifyInfoPayload{
Unsaved: unsaved[0],
@@ -36,7 +37,7 @@ func NotifyUserBatch(nx *nex.Conn, userId []uint64, notify pushkit.Notification,
if len(unsaved) == 0 {
unsaved = append(unsaved, false)
}
- _, err = proto.NewNotifyServiceClient(conn).NotifyUserBatch(nil, &proto.NotifyUserBatchRequest{
+ _, err = proto.NewNotifyServiceClient(conn).NotifyUserBatch(context.Background(), &proto.NotifyUserBatchRequest{
UserId: userId,
Notify: &proto.NotifyInfoPayload{
Unsaved: unsaved[0],
diff --git a/pkg/authkit/realm.go b/pkg/authkit/realm.go
index e7eae04..d9da354 100644
--- a/pkg/authkit/realm.go
+++ b/pkg/authkit/realm.go
@@ -1,6 +1,7 @@
package authkit
import (
+ "context"
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"git.solsynth.dev/hypernet/passport/pkg/authkit/models"
"git.solsynth.dev/hypernet/passport/pkg/proto"
@@ -13,7 +14,7 @@ func GetRealm(nx *nex.Conn, id uint) (models.Realm, error) {
if err != nil {
return realm, err
}
- resp, err := proto.NewRealmServiceClient(conn).GetRealm(nil, &proto.LookupRealmRequest{
+ resp, err := proto.NewRealmServiceClient(conn).GetRealm(context.Background(), &proto.LookupRealmRequest{
Id: lo.ToPtr(uint64(id)),
})
if err != nil {
@@ -28,7 +29,7 @@ func GetRealmByAlias(nx *nex.Conn, alias string) (models.Realm, error) {
if err != nil {
return realm, err
}
- resp, err := proto.NewRealmServiceClient(conn).GetRealm(nil, &proto.LookupRealmRequest{
+ resp, err := proto.NewRealmServiceClient(conn).GetRealm(context.Background(), &proto.LookupRealmRequest{
Alias: &alias,
})
if err != nil {
@@ -43,7 +44,7 @@ func ListRealm(nx *nex.Conn, id []uint) ([]models.Realm, error) {
if err != nil {
return realms, err
}
- resp, err := proto.NewRealmServiceClient(conn).ListRealm(nil, &proto.ListRealmRequest{
+ resp, err := proto.NewRealmServiceClient(conn).ListRealm(context.Background(), &proto.ListRealmRequest{
Id: lo.Map(id, func(item uint, _ int) uint64 {
return uint64(item)
}),
@@ -63,7 +64,7 @@ func GetRealmMember(nx *nex.Conn, realmID, userID uint) (models.RealmMember, err
if err != nil {
return member, err
}
- resp, err := proto.NewRealmServiceClient(conn).GetRealmMember(nil, &proto.RealmMemberLookupRequest{
+ resp, err := proto.NewRealmServiceClient(conn).GetRealmMember(context.Background(), &proto.RealmMemberLookupRequest{
RealmId: lo.ToPtr(uint64(realmID)),
UserId: lo.ToPtr(uint64(userID)),
})
@@ -79,7 +80,7 @@ func ListRealmMember(nx *nex.Conn, realmID uint) ([]models.RealmMember, error) {
if err != nil {
return members, err
}
- resp, err := proto.NewRealmServiceClient(conn).ListRealmMember(nil, &proto.RealmMemberLookupRequest{
+ resp, err := proto.NewRealmServiceClient(conn).ListRealmMember(context.Background(), &proto.RealmMemberLookupRequest{
RealmId: lo.ToPtr(uint64(realmID)),
})
if err != nil {
@@ -96,7 +97,7 @@ func CheckRealmMemberPerm(nx *nex.Conn, realmID uint, userID, power int) bool {
if err != nil {
return false
}
- resp, err := proto.NewRealmServiceClient(conn).CheckRealmMemberPerm(nil, &proto.CheckRealmPermRequest{
+ resp, err := proto.NewRealmServiceClient(conn).CheckRealmMemberPerm(context.Background(), &proto.CheckRealmPermRequest{
RealmId: uint64(realmID),
UserId: uint64(userID),
PowerLevel: int32(power),
diff --git a/pkg/authkit/relative.go b/pkg/authkit/relative.go
index 8242da7..39a3938 100644
--- a/pkg/authkit/relative.go
+++ b/pkg/authkit/relative.go
@@ -1,6 +1,7 @@
package authkit
import (
+ "context"
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"git.solsynth.dev/hypernet/nexus/pkg/proto"
)
@@ -10,10 +11,13 @@ func ListRelative(nx *nex.Conn, userId uint, status int32, isRelated bool) ([]*p
if err != nil {
return nil, err
}
- resp, err := proto.NewUserServiceClient(conn).ListUserRelative(nil, &proto.ListUserRelativeRequest{
+ resp, err := proto.NewUserServiceClient(conn).ListUserRelative(context.Background(), &proto.ListUserRelativeRequest{
UserId: uint64(userId),
Status: status,
IsRelated: isRelated,
})
+ if err != nil {
+ return nil, err
+ }
return resp.GetData(), err
}