Skip to content

Commit

Permalink
Merge pull request #11 from MaximeZmt/Work-Mzmt-FixAddAdmin
Browse files Browse the repository at this point in the history
fix: do reinsert existing admin
  • Loading branch information
MaximeZmt authored May 29, 2024
2 parents 7242c71 + e3454c4 commit d2080fd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions contracts/evoting/types/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ func (adminList *AdminList) AddAdmin(userID string) error {
return xerrors.Errorf("Failed to convert SCIPER to int: %v", err)
}

index, err := adminList.GetAdminIndex(userID)
if err != nil {
return err
}

if index > -1 {
return xerrors.Errorf("The user %v is already an admin", userID)
}

adminList.AdminList = append(adminList.AdminList, sciperInt)

return nil
Expand Down

0 comments on commit d2080fd

Please sign in to comment.