2 Commits

Author SHA1 Message Date
8e2806deb2 imporved auth verify logs
All checks were successful
Build and Push Docker Image / Build image (push) Successful in 1m41s
2025-05-27 12:39:38 +03:00
6c2c305e2d added upsert to permissions
All checks were successful
Build and Push Docker Image / Build image (push) Successful in 1m40s
2025-05-26 16:18:21 +03:00
2 changed files with 3 additions and 2 deletions

View File

@@ -175,8 +175,8 @@ func (con AuthApi) Verify(ctx *gin.Context) {
switch service {
case "browsers":
fmt.Printf("%#v %s", claims, serverId)
serverPermissions, err := con.serverAuthDbHandler.GetPermissions(ctx, claims.Username, serverId)
fmt.Printf("User: %s | GlobalPermissions: %d | ServerId: %s | ServerPermissions: %d\n", claims.Username, claims.Permissions, serverId, serverPermissions)
if err != nil {
ctx.AbortWithError(500, err)
return

View File

@@ -52,7 +52,7 @@ func (self *ServersAuthorizationDbHandler) AddPermissions(ctx context.Context, u
"server_id": serverId,
},
).Decode(&serverPermissions)
if err != nil {
if err != nil && err != mongo.ErrNoDocuments {
return err
}
@@ -120,6 +120,7 @@ func (self *ServersAuthorizationDbHandler) SetPermissions(ctx context.Context, u
"permissions": permissions,
},
},
options.Update().SetUpsert(true),
)
return err