Skip to content

Commit

Permalink
fix(ac): fixed access for nil time.Time (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI authored Aug 28, 2024
1 parent 991fed5 commit 9b2ef03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion internal/dashboard/business/ac/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,16 @@ func PatchAccount(ctx context.Context, username string, param *acmodel.PatchAcco
accountChanged = true
}
if accountChanged {
var lastLoginUnix int64
if acc.LastLoginAt != nil {
lastLoginUnix = acc.LastLoginAt.Unix()
}
up := &acmodel.UpdateAccountCreds{
Username: username,
AccountCreds: acmodel.AccountCreds{
EncryptedPassword: acc.password,
Nickname: acc.Nickname,
LastLoginAtUnix: acc.LastLoginAt.Unix(),
LastLoginAtUnix: lastLoginUnix,
Description: acc.Description,
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/dashboard/router/v1/obcluster_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
func InitOBClusterRoutes(g *gin.RouterGroup) {
g.GET("/obclusters/statistic", h.Wrap(h.GetOBClusterStatistic, acbiz.PathGuard("obcluster", "", "read")))
g.GET("/obclusters", h.Wrap(h.ListOBClusters, acbiz.PathGuard("obcluster", "", "read")))
g.POST("/obclusters", h.Wrap(h.CreateOBCluster, acbiz.PathGuard("obcluster", "*", "read")))
g.POST("/obclusters", h.Wrap(h.CreateOBCluster, acbiz.PathGuard("obcluster", "*", "write")))
g.GET("/obclusters/namespace/:namespace/name/:name", h.Wrap(h.GetOBCluster, acbiz.PathGuard("obcluster", ":namespace+:name", "read")))
g.POST("/obclusters/namespace/:namespace/name/:name", h.Wrap(h.UpgradeOBCluster, acbiz.PathGuard("obcluster", ":namespace+:name", "write")))
g.DELETE("/obclusters/namespace/:namespace/name/:name", h.Wrap(h.DeleteOBCluster, acbiz.PathGuard("obcluster", ":namespace+:name", "write")))
Expand Down
3 changes: 2 additions & 1 deletion internal/dashboard/router/v1/obtenant_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ package v1
import (
"github.com/gin-gonic/gin"

acbiz "github.com/oceanbase/ob-operator/internal/dashboard/business/ac"
"github.com/oceanbase/ob-operator/internal/dashboard/business/oceanbase"
h "github.com/oceanbase/ob-operator/internal/dashboard/handler"
)

func InitOBTenantRoutes(g *gin.RouterGroup) {
g.GET("/obtenants", h.Wrap(h.ListAllTenants))
g.GET("/obtenants/statistic", h.Wrap(h.GetOBTenantStatistic))
g.GET("/obtenants/statistic", h.Wrap(h.GetOBTenantStatistic, acbiz.PathGuard("obcluster", "", "read")))
g.PUT("/obtenants", h.Wrap(h.CreateTenant))

g.GET("/obtenants/:namespace/:name", h.Wrap(h.GetTenant, oceanbase.TenantGuard(":namespace", ":name", "read")))
Expand Down

0 comments on commit 9b2ef03

Please sign in to comment.