mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
make fmt
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user