Skip to content

Commit

Permalink
updated unlock condition (#3770)
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-579 authored and Ash-exp committed Aug 21, 2023
1 parent 70f119e commit 6b6402e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkg/user/UserService.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,12 @@ func (impl *UserServiceImpl) UpdateUser(userInfo *bean.UserInfo, token string, m
impl.logger.Errorw("error in locking, lockUnlockUserReqState", "userId", userInfo.Id)
return nil, false, false, nil, err
}
defer func() {
err = impl.lockUnlockUserReqState(userInfo.Id, false)
if err != nil {
impl.logger.Errorw("error in unlocking, lockUnlockUserReqState", "userId", userInfo.Id)
}
}()
}
//validating if action user is not admin and trying to update user who has super admin polices, return 403
isUserSuperAdmin, err := impl.IsSuperAdmin(int(userInfo.Id))
Expand Down Expand Up @@ -859,13 +865,6 @@ func (impl *UserServiceImpl) UpdateUser(userInfo *bean.UserInfo, token string, m
}
//loading policy for syncing orchestrator to casbin with newly added policies
casbin2.LoadPolicy()

err = impl.lockUnlockUserReqState(userInfo.Id, false)
if err != nil {
impl.logger.Errorw("error in unlocking, lockUnlockUserReqState", "userId", userInfo.Id)
return nil, false, false, nil, err
}

return userInfo, rolesChanged, groupsModified, restrictedGroups, nil
}

Expand Down

0 comments on commit 6b6402e

Please sign in to comment.