aa
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/permission"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/jd"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/globals/api/apimanager"
|
||||
@@ -561,6 +563,14 @@ func AddUsers4Role(ctx *jxcontext.Context, r *authz.RoleInfo, userIDList []strin
|
||||
|
||||
errList := errlist.New()
|
||||
for _, v := range userIDList {
|
||||
if permission.IsRoledByUserID(v) {
|
||||
if storeIDsMap, err := permission.GetUserStoresResultMap(v); err == nil {
|
||||
if storeIDsMap[r.StoreID] == 0 {
|
||||
return fmt.Errorf("此用户没有该门店[%v]的权限,无法添加到分组", r.StoreID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err = checkUserType(v, model.UserTypeNonConsumer); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -413,3 +413,12 @@ func IsRoled(ctx *jxcontext.Context) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func IsRoledByUserID(userID string) bool {
|
||||
if user, err := dao.GetUserByID(dao.GetDB(), "user_id", userID); err == nil {
|
||||
if user.Type&model.UserTypeRole != 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user