Essentially two theories, although im sure there are others, but the courts are generally relying on fairness and reasonableness.
Not saying I agree with the decisions, but here's how the courts asserted authority:
Diego Pavia successfully argued the NCAA was violating anti trust laws by counting his JUCO years against his NCAA eligibility. The NCAA does not count other types of post High School competition against NCAA eligibility (foreign leagues, finishing school types of leagues, etc.), but discriminated against JUCO players limiting their development and earning potential.
Chambliss, Bediako, and Sorsby did not directly ochallenge the NCAA's eligibility rules, but instead argued the league was not applying its own exceptions or disciplinary rules consistently and fairly. They claimed that was a breach of the contractual duty of good faith and fair dealing.
None of these players has actually won their underlying case yet (maybe Pavia has, Im not sure) but instead were granted preliminary injunctions to avoid the irreparable harm from being denied a year of participation....apparently without consideration of the irreparable harm to the other players in the league who have to play against - or sit the bench behind - a player who was ruled ineligible. (That ladt bit is my editorial).
I dont think the players who are suing to be included in the new 5 for 5 rule are suffering irreparable harm. They clearly are not good enough to play professionally, or else they would already be doing that. They are missing out on a bonus year of play, but that is not "irreperable"; you can put a price on it.