diff --git a/pkg/cloudcommon/auth.go b/pkg/cloudcommon/auth.go index 0e13195096..22220a7e1c 100644 --- a/pkg/cloudcommon/auth.go +++ b/pkg/cloudcommon/auth.go @@ -4,9 +4,9 @@ import ( "fmt" "os" + "time" "yunion.io/x/onecloud/pkg/cloudcommon/db" "yunion.io/x/onecloud/pkg/mcclient/auth" - "time" ) func InitAuth(options *Options, authComplete auth.AuthCompletedCallback) { diff --git a/pkg/cloudcommon/db/quotas/handler.go b/pkg/cloudcommon/db/quotas/handler.go index 24da096fb9..80bfeedd21 100644 --- a/pkg/cloudcommon/db/quotas/handler.go +++ b/pkg/cloudcommon/db/quotas/handler.go @@ -76,7 +76,7 @@ func getQuotaHanlder(ctx context.Context, w http.ResponseWriter, r *http.Request if len(projectId) == 0 { projectId = userCred.GetProjectId() if db.IsGlobalRbacEnabled() { - if ! db.PolicyManager.Allow(false, userCred, db.GetGlobalServiceType(), + if !db.PolicyManager.Allow(false, userCred, db.GetGlobalServiceType(), "quotas", db.PolicyActionGet) { httperrors.ForbiddenError(w, "not allow to get quota") return @@ -90,12 +90,12 @@ func getQuotaHanlder(ctx context.Context, w http.ResponseWriter, r *http.Request } else { isAllow = userCred.IsSystemAdmin() } - if ! isAllow { + if !isAllow { httperrors.ForbiddenError(w, "not allow to delegate query quota") return } if db.IsGlobalRbacEnabled() { - if ! db.PolicyManager.Allow(true, userCred, db.GetGlobalServiceType(), + if !db.PolicyManager.Allow(true, userCred, db.GetGlobalServiceType(), "quotas", db.PolicyActionGet) { httperrors.ForbiddenError(w, "not allow to query quota") return @@ -200,12 +200,12 @@ func checkQuotaHanlder(ctx context.Context, w http.ResponseWriter, r *http.Reque } else { isAllow = userCred.IsSystemAdmin() } - if ! isAllow { + if !isAllow { httperrors.ForbiddenError(w, "not allow to delegate check quota") return } if db.IsGlobalRbacEnabled() { - if ! db.PolicyManager.Allow(true, userCred, db.GetGlobalServiceType(), + if !db.PolicyManager.Allow(true, userCred, db.GetGlobalServiceType(), "quotas", db.PolicyActionGet) { httperrors.ForbiddenError(w, "not allow to query quota") return diff --git a/pkg/compute/usages/handler.go b/pkg/compute/usages/handler.go index 27eae7c03d..71899df1ea 100644 --- a/pkg/compute/usages/handler.go +++ b/pkg/compute/usages/handler.go @@ -263,7 +263,7 @@ func ReportGeneralUsage(userCred mcclient.TokenCredential, rangeObj db.IStandalo } if db.IsGlobalRbacEnabled() { - if ! db.PolicyManager.Allow(false, userCred, db.GetGlobalServiceType(), + if !db.PolicyManager.Allow(false, userCred, db.GetGlobalServiceType(), "usages", db.PolicyActionGet) { err = httperrors.NewForbiddenError("not allow to get usages") return