mm
This commit is contained in:
@@ -1484,14 +1484,14 @@ type permission struct {
|
||||
Object string `json:"object"`
|
||||
}
|
||||
|
||||
func IsPermissionAllowed(token, method, module, dbname, tbname string) (bool, error) {
|
||||
func IsPermissionAllowed(token, method, module, dbname, tbname, pack string) (bool, error) {
|
||||
log.Info("IsPermissionAllowed processing... ")
|
||||
|
||||
exist, err := xEngine.Table("permission").
|
||||
Join("INNER", "role_permission", "permission.permission_name = role_permission.p_name").
|
||||
Join("INNER", "user_role", "role_permission.r_name = user_role.r_name").
|
||||
Join("INNER", "session", "user_role.u_name = session.account_id and session.access_token=?", token).
|
||||
Where("method in ('*',?) and management in ('*',?) and element in ('*',?) and object in ('*',?)", method, module, dbname, tbname).
|
||||
Where("method in ('*',?) and module in ('*',?) and management in ('*',?) and element in ('*',?) and object in ('*',?)", method, pack, module, dbname, tbname).
|
||||
Exist()
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
||||
@@ -417,7 +417,7 @@ func CheckCommonValidRequest(w http.ResponseWriter, r *http.Request) (string, er
|
||||
return token, nil
|
||||
}
|
||||
|
||||
func CheckUserPermission(token, method, module, dbname, tbname string) (bool, error) {
|
||||
func CheckUserPermission(token, method, module, dbname, tbname, pack string) (bool, error) {
|
||||
if config.GetYamlConfig().OMC.RBACMode == true {
|
||||
if module == "" {
|
||||
module = "*"
|
||||
@@ -428,7 +428,7 @@ func CheckUserPermission(token, method, module, dbname, tbname string) (bool, er
|
||||
if tbname == "" {
|
||||
tbname = "*"
|
||||
}
|
||||
exist, err := dborm.IsPermissionAllowed(token, method, module, dbname, tbname)
|
||||
exist, err := dborm.IsPermissionAllowed(token, method, module, dbname, tbname, pack)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user