aa
This commit is contained in:
@@ -4097,12 +4097,25 @@ func RefreshStoreBind(ctx *jxcontext.Context) (err error) {
|
||||
task := tasksch.NewParallelTask("RefreshStoreBind", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
store := batchItemList[0].(*model.Store)
|
||||
var userIDs []string
|
||||
var (
|
||||
userIDmap1 = make(map[string]string)
|
||||
userIDmap2 = make(map[string]string)
|
||||
userIDs []string
|
||||
)
|
||||
userList := getAllUsers4Store(ctx, db, store)
|
||||
for _, v := range userList {
|
||||
userIDs = append(userIDs, v.UserID)
|
||||
userIDmap1[v.UserID] = v.UserID
|
||||
}
|
||||
err = AddUsers4Role(ctx, autils.NewRole(authz.StoreRoleBoss, store.ID), userIDs)
|
||||
nowUserIDs, _ := GetRoleUserList(ctx, autils.NewRole(authz.StoreRoleBoss, store.ID))
|
||||
for _, v := range nowUserIDs {
|
||||
userIDmap2[v] = v
|
||||
}
|
||||
for _, v := range userIDmap1 {
|
||||
if userIDmap2[v] == "" {
|
||||
userIDs = append(userIDs, v)
|
||||
}
|
||||
}
|
||||
AddUsers4Role(ctx, autils.NewRole(authz.StoreRoleBoss, store.ID), userIDs)
|
||||
return retVal, err
|
||||
}, stores)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
|
||||
Reference in New Issue
Block a user