According to the law of inheritance...
According to the law of inheritance, like the other physical effects, inner qualities and thinking of the mother and father is also transferred to the children. In the same way the special traits of the parents are transferred to children like the color of eyes, hair, shape of the eyebrows etc. In reality inheritance is the base for a persons future and makes the personality of an individual and prepares the ground for them for their good or bad fortune.
From these points we can derive the following results: Illegitimate children inherit bad manners, breaking of laws, and sins from their parents. For them the ground for sins and crime is more feasible. As compared to others they are more prepared for sins and if they personally get wrong training or if the environment is not good, then it is enough for them that their polluted soul, like sparks beneath the ash become fire and burn their good fortune.
As for the question about social posts for illegitimate persons, it is a logical precaution for the protection of social good on the basis of whatever is said above about their psychological state. Islam gives much importance to persons who are supposed to take these social posts, for acquiring the confidence of the people. Therefore those families which have some defects or whose past is not praiseworthy have been deprived of posts that require spiritual purity.
But we should not be that a person of illegitimate birth has the license to commit all sins and go against the Sharia, and that he be deprived of true Islamic teachings and training, and he by following the right principles cannot be fortunate No, it is not like that. Illegitimate children also like natural and lawful children are free to choose the right or wrong path.
They also with their intentions and powers can choose the path of righteousness and goodness and acquire salvation and be one of the Heavenly people. It is not that they are born criminals and at any cost cannot be freed from the web of crimes and sins, but as Imam Sadiq (a.s.) has said: When an illegitimate child is prepared to perform his duties and able to do work of training, if his deeds are good he will get rewards for it and if he does bad he will be punished.