dd
This commit is contained in:
@@ -163,7 +163,7 @@ func IsVallidContentType(r *http.Request, checkFlag bool) bool {
|
||||
return false
|
||||
}
|
||||
*/
|
||||
if strings.Contains(r.Header.Get("Content-Type"), "application/json") || checkFlag == false {
|
||||
if strings.Contains(r.Header.Get("Content-Type"), "application/json") || !checkFlag {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -298,14 +298,14 @@ func CheckNorthboundValidRequest(w http.ResponseWriter, r *http.Request) (string
|
||||
// error processing ...
|
||||
// 401-1 response
|
||||
token, ret = oauth.IsCarriedToken(r)
|
||||
if ret == false {
|
||||
if !ret {
|
||||
log.Error("accessToken is not carried")
|
||||
ResponseUnauthorized401AccessTokenNotCarried(w)
|
||||
return token, err
|
||||
}
|
||||
|
||||
// 401-2 response
|
||||
if dborm.XormExistValidToken(token, config.GetExpiresFromConfig()) == false {
|
||||
if !dborm.XormExistValidToken(token, config.GetExpiresFromConfig()) {
|
||||
log.Error("accessToken fails or does not exist")
|
||||
ResponseUnauthorized401AccessTokenNotExist(w)
|
||||
return token, err
|
||||
@@ -393,7 +393,7 @@ func CheckCommonValidRequest(w http.ResponseWriter, r *http.Request) (string, er
|
||||
}
|
||||
|
||||
// 401-2 response
|
||||
if dborm.XormExistValidToken(token, config.GetExpiresFromConfig()) == false {
|
||||
if !dborm.XormExistValidToken(token, config.GetExpiresFromConfig()) {
|
||||
log.Error("accessToken fails or does not exist")
|
||||
ResponseUnauthorized401AccessTokenNotExist(w)
|
||||
return token, err
|
||||
@@ -420,7 +420,7 @@ func CheckCommonValidRequest(w http.ResponseWriter, r *http.Request) (string, er
|
||||
}
|
||||
|
||||
func CheckUserPermission(token, method, module, dbname, tbname, pack string) (bool, error) {
|
||||
if config.GetYamlConfig().OMC.RBACMode == true {
|
||||
if config.GetYamlConfig().OMC.RBACMode {
|
||||
if module == "" {
|
||||
module = "*"
|
||||
}
|
||||
@@ -477,7 +477,7 @@ func CheckFrontValidRequest(w http.ResponseWriter, r *http.Request) (string, err
|
||||
|
||||
// error processing ...
|
||||
// 401-1 response
|
||||
if config.GetYamlConfig().Auth.Token && IsLocalhost(r.RemoteAddr) == false {
|
||||
if config.GetYamlConfig().Auth.Token && !IsLocalhost(r.RemoteAddr) {
|
||||
token, ret = oauth.IsCarriedToken(r)
|
||||
if !ret {
|
||||
err = errors.New("accessToken is not carried")
|
||||
@@ -487,7 +487,7 @@ func CheckFrontValidRequest(w http.ResponseWriter, r *http.Request) (string, err
|
||||
}
|
||||
|
||||
// 401-2 response
|
||||
if dborm.XormExistValidToken(token, config.GetExpiresFromConfig()) == false {
|
||||
if !dborm.XormExistValidToken(token, config.GetExpiresFromConfig()) {
|
||||
err = errors.New("accessToken fails or does not exist")
|
||||
log.Error(err)
|
||||
ResponseUnauthorized401AccessTokenNotExist(w)
|
||||
@@ -535,7 +535,7 @@ func CheckExtValidRequest(w http.ResponseWriter, r *http.Request) (string, error
|
||||
}
|
||||
|
||||
// 401-2 response
|
||||
if dborm.XormExistValidToken(token, config.GetExpiresFromConfig()) == false {
|
||||
if !dborm.XormExistValidToken(token, config.GetExpiresFromConfig()) {
|
||||
err = errors.New("accessToken fails or does not exist")
|
||||
log.Error(err)
|
||||
ResponseUnauthorized401AccessTokenNotExist(w)
|
||||
|
||||
Reference in New Issue
Block a user