Section 21. Commitment to the care of the department of a delinquent child or youthful offender shall not operate to disqualify said child in any future examination, appointment or application for public service under the government either of the commonwealth or of any political subdivision thereof.
Whenever a person committed to the department by a court upon conviction of a crime is discharged from its control such discharge shall, when so ordered by the department, restore such person to all civil rights and shall have the effect of setting aside the conviction. The conviction of such a person shall not operate to disqualify him for any future examination, appointment or application for public service under the government either of the commonwealth or of any political subdivision thereof.
The records of commitment to the department shall be withheld from public inspection except with the consent of the department, but such records concerning any child who at the time of commitment was between seven and 18 years of age shall be open, at all reasonable times, to the inspection of the child, his or her parent or parents, guardian or attorney, or any of them. A commitment to the department shall not be received in evidence or used in any way in any proceeding in any court except in subsequent proceedings for waywardness or delinquency against the same child, and except in imposing sentence in any criminal proceeding against the same person.