Question of necessary and proper parties is a vex question of law.
Civil Procedure Code, 1908: Order 1 Rule 10(2).
The said sub-rule is not about the right of a non-party to be impleaded as a party, but about the judicial discretion of the court to strike out or add parties at any stage of a proceeding. The discretion under the sub-rule can be exercised either suo moto or on the application of the plaintiff or the defendant, or on an application of a person who is not a party to the suit. The court can strike out any party who is improperly joined. The court can add anyone as a plaintiff or as a defendant if it finds that he is a necessary party or proper party. Such deletion or addition can be without any conditions or subject 1 to such terms as the court deems fit to impose. In exercising its judicial discretion under Order 1 Rule 10(2) of the Code, the court will of course act according to reason and fair play and not according to whims and caprice. This Court in Ramji Dayawala & Sons (P) Ltd. vs. Invest Import –  INSC 196
; 1981 (1) SCC 80
, reiterated the classic definition of `discretion’ by Lord Mansfield in R. vs. Wilkes –  EngR 32
; 1770 (98) ER 327
, that `discretion’ when applied to courts of justice, means sound discretion guided by law.
Discretion to add parties must be governed by rule, not by humour;
it must not be arbitrary, vague, and fanciful, `but legal and regular’.
Some illustrations regarding exercise of discretion to add parties under the said Sub-Rule.
1) If a plaintiff makes an application for impleading a person as a defendant on the ground that he is a necessary party, the court may implead him having regard to the provisions of Rules 9 and 10(2) of Order I. If the claim against such a person is barred by limitation, it may refuse to add him as a party and even dismiss the suit for non-joinder of a necessary party.
2) If the owner of a tenanted property enters into an agreement for sale of such property without physical possession, in a suit for specific performance by the purchaser, the tenant would not be a necessary party.
But if the suit for specific performance is filed with an additional prayer for delivery of physical possession from the tenant in possession, then the tenant will be a necessary party in so far as the prayer for actual possession.
3) If a person makes an application for being impleaded contending that he is a necessary party, and if the court finds that he is a necessary party, it can implead him. If the plaintiff opposes such impleadment, then instead of impleading such a party, who is found to be a necessary party, the court may proceed to dismiss the suit by holding that the applicant was a necessary party and in his absence the plaintiff was not entitled to any relief in the suit.
4) If an application is made by a plaintiff for impleading someone as a proper party, subject to limitation, bonfides etc., the court will normally implead him, if he is found to be a proper party. On the other hand, if a non-party makes an application seeking impleadment as a proper party and court finds him to be a proper party, the court may direct his addition as a defendant; but if the court finds that his addition will alter the nature of the suit or introduce a new cause of action, it may dismiss the application even if he is found to be a proper party, if it does not want to widen the scope of the specific performance suit; or the court may direct such applicant to be impleaded as a proper party, either unconditionally or subject to terms.
Example for impleadment of parties:
For example, if `D’ claiming to be a co-owner of a suit property, enters into an agreement for sale of his share in favour of `P’ representing that he is the co-owner with half share, and `P’ files a suit for specific performance of the said agreement of sale in respect of the undivided half share, the court may permit the other co-owner who contends that `D’ has only one-fourth share, to be impleaded as an additional defendant as a proper party, and may examine the issue whether the plaintiff is entitled to specific performance of the agreement in respect of half a share or only one-fourth share; alternatively the court may refuse to implead the other co-owner and leave open the question in regard to the extent of share of the vendor-defendant to be decided in an independent proceeding by the other co-owner, or the plaintiff; alternatively the court may implead him but subject to the term that the dispute, if any, between the impleaded co-owner and the original defendant in regard to the extent of the share will not be the subject matter of the suit for specific performance, and that it will decide in the suit, only the issues relating to specific performance, that is whether the defendant executed the agreement/contract and whether such contract should be specifically enforced. In other words, the court has the discretion to either to allow or reject an application of a person claiming to be a proper party, depending upon the facts and circumstances and no person has a right to insist that he should be impleaded as a party, merely because he is a proper party.
Source: MUMBAI INTERNATIONAL AIRPORT PVT. LTD. v. REGENCY CONVENTION CENTRA & HOTELS & ORS  INSC 447 (6 July 2010)