This commit is contained in:
2023-08-18 13:57:36 +08:00
parent 3e726ddd99
commit 882baa2e0b
5 changed files with 49 additions and 34 deletions

View File

@@ -417,9 +417,18 @@ func CheckCommonValidRequest(w http.ResponseWriter, r *http.Request) (string, er
return token, nil
}
func CheckUserPermission(token, method, dbname, tbname string) (bool, error) {
func CheckUserPermission(token, method, module, dbname, tbname string) (bool, error) {
if config.GetYamlConfig().OMC.RBACMode == true {
exist, err := dborm.IsPermissionAllowed(token, method, dbname, tbname)
if module == "" {
module = "*"
}
if dbname == "" {
dbname = "*"
}
if tbname == "" {
tbname = "*"
}
exist, err := dborm.IsPermissionAllowed(token, method, module, dbname, tbname)
if err != nil {
return false, err
}