@@ -674,6 +674,12 @@ func (impl *UserServiceImpl) UpdateUser(userInfo *bean.UserInfo, token string, m
674674 impl .logger .Errorw ("error in locking, lockUnlockUserReqState" , "userId" , userInfo .Id )
675675 return nil , false , false , nil , err
676676 }
677+ defer func () {
678+ err = impl .lockUnlockUserReqState (userInfo .Id , false )
679+ if err != nil {
680+ impl .logger .Errorw ("error in unlocking, lockUnlockUserReqState" , "userId" , userInfo .Id )
681+ }
682+ }()
677683 }
678684 //validating if action user is not admin and trying to update user who has super admin polices, return 403
679685 isUserSuperAdmin , err := impl .IsSuperAdmin (int (userInfo .Id ))
@@ -859,13 +865,6 @@ func (impl *UserServiceImpl) UpdateUser(userInfo *bean.UserInfo, token string, m
859865 }
860866 //loading policy for syncing orchestrator to casbin with newly added policies
861867 casbin2 .LoadPolicy ()
862-
863- err = impl .lockUnlockUserReqState (userInfo .Id , false )
864- if err != nil {
865- impl .logger .Errorw ("error in unlocking, lockUnlockUserReqState" , "userId" , userInfo .Id )
866- return nil , false , false , nil , err
867- }
868-
869868 return userInfo , rolesChanged , groupsModified , restrictedGroups , nil
870869}
871870
0 commit comments