This commit is contained in:
Qiu Jian
2018-10-29 14:54:01 +08:00
parent 11dddd8ad3
commit 740d6800ef
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -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) {
+5 -5
View File
@@ -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
+1 -1
View File
@@ -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