
933 A.2d 1081 (2007)
Demetrius BAILEY, Richard Sutton, Josh Griffin, Jamiel Johnson, Appellants
v.
David WAKEFIELD, M.W. Harlow, Deputy Lawler, Major Glunt, Lt. Ewing, Lt. Walter, Mary Lou Showalter, Angela Auman.
Commonwealth Court of Pennsylvania.
Submitted on Briefs September 7, 2007.
Decided October 4, 2007.
*1082 Demetrius Bailey, appellant, pro se.
Vincent R. Mazeski, Asst. Counsel and Suzanne N. Hueston, Chief Counsel for Corrections, Camp Hill, for appellees.
BEFORE: McGINLEY, Judge, PELLEGRINI, Judge, and LEAVITT, Judge.
OPINION BY Judge PELLEGRINI.
Demetrius Bailey, Richard Sutton, Josh Griffin and Jamiel Johnson (collectively, Bailey) appeal pro se from an order of the *1083 Court of Common Pleas of Huntingdon County (trial court) denying leave to file an action in forma pauperis (IFP) and dismissing this action seeking a writ of mandamus against Respondents[1] under Pennsylvania Rule of Civil Procedure (Pa. R.C.P.) No. 240(j) because it was frivolous.[2]
Bailey is incarcerated in the Restrictive Housing Unit (RHU) at the State Correctional Institution in Huntingdon, Pennsylvania (SCIH). On May 16, 2007, Bailey filed a writ of mandamus[3] alleging that he was subject to prison conditions that violated the 1st, 8th and 14th Amendments to the United States Constitution and Article 1, Sections 7, 9, 13 and 20 of the Pennsylvania Constitution. He also asserted that the conditions were in violation of several state regulations and Department of Corrections (Department) policy. The facts that he alleged that supported those violations were: family members could not see the prisoner during visits to the prison; the use of restraints during law library visits; a requirement of wearing unsanitary undergarments; the retaliatory denial of food, showers, etc. in response to the filing of prison grievances and complaints; the opening of prisoners' legal mail outside of the recipients' presence; a prohibition on the use of the law library; and the denial of medical treatment to Bailey for a dermatological and gastrointestinal condition.
Pursuant to Pa. R.C.P. No. 240(j), the trial court denied the petition to file an action in forma pauperis and dismissed the mandamus action finding it frivolous. It did so because it found that the action did not have a basis in law or in fact and that mandamus was not the proper form of action for challenging the constitutionality of a statute, regulation or policy. After his motion for reconsideration was denied, Bailey then took this appeal.[4]
On appeal, Bailey argues that the trial court erred in dismissing the mandamus action as frivolous because his petition does set forth valid grounds upon which relief can be granted. A frivolous action has been defined as "[o]ne that `lacks an arguable basis either in law or in fact.'"[5] An action is frivolous under this provision, if, on its face, it does not set forth a valid *1084 cause of action. Keller v. Kinsley, 415 Pa.Super. 366, 609 A.2d 567 (1992). Based on the facts, Bailey's complaint is not frivolous because it sets forth valid causes of action against the Department for violations of the prison regulations, policies and the United States and Pennsylvania Constitutions.[6] The question, then, is even though it sets forth a cause of action, whether the action is still frivolous because Bailey filed a mandamus action, a form of action that cannot address the constitutional rights that he pled.
Bailey contends that mandamus is the appropriate form of action to compel the prison officials to perform their tasks and duties according to various regulations and policies. Bailey cited numerous prison regulations and constitutional amendments to support his mandamus action; each gives discretion to prison officials in how those duties will be carried out.[7] Similarly, individual rights guaranteed under the federal or state constitution may be "curtailed whenever prison officials, in the exercise of their informed discretion, reasonably conclude that those rights possess the likelihood of disrupting prison order or stability or otherwise interfering with the legitimate penological objectives of the prison environment." Department of Public Welfare, Farview State Hospital v. Kallinger, 134 Pa.Cmwlth. 415, 580 A.2d 887, 890-891 (1990). Because every violation of the rights Bailey alleged in his action is balanced against the need for orderly administration of the prison, those acts are discretionary, and an action seeking a writ of mandamus is not maintainable. Maute v. Frank, 670 A.2d 737 (Pa.Cmwlth.1996).[8]
Because there is no way that Bailey can be successful, the trial court properly denied the petition seeking to proceed in forma pauperis and dismissed the action seeking a writ of mandamus as frivolous.[9]
Accordingly, the order of the trial court is affirmed.

ORDER
AND NOW, this 4th day of October, 2007, the order of the Court of Common Pleas of Huntingdon County, dated June 19, 2007, is affirmed.
NOTES
[1]  The "writ" does not specifically identify any of the named Respondents, but we glean from other paragraphs in the writ that named Respondents are various officers and employees of the Department of Corrections at the State Correctional Institution at Huntington.
[2]  Pa. R.C.P. No. 240(j) provides, in relevant part:

If, simultaneous with the commencement of an action or proceeding or the taking of an appeal, a party has filed a petition for leave to proceed in forma pauperis, the court prior to acting upon the petition may dismiss the action, proceeding or appeal if the allegation of poverty is untrue or if it is satisfied that the action, proceeding or appeal is frivolous.
[3]  A writ of mandamus is an extraordinary remedy designed to compel official performance of a ministerial act or mandatory duty. McGriff v. Pennsylvania Board of Probation and Parole, 809 A.2d 455 (Pa.Cmwlth.2002). In order to obtain a writ of mandamus, a petitioner must demonstrate: (1) a clear legal right in the petition; (2) a corresponding duty in the respondent; and (3) the absence of any other appropriate or adequate remedy. Equitable Gas Company v. City of Pittsburgh, 507 Pa. 53, 488 A.2d 270 (1985).
[4]  When reviewing the decision of a trial court, our scope of review is limited to a determination of whether constitutional rights have been violated or whether the trial court abused its discretion or committed an error of law. Mann v. City of Philadelphia, 128 Pa. Cmwlth. 499, 563 A.2d 1284 (1989).
[5]  Note to Pa. R.C.P. No. 240, citing Neitzke v. Williams, 490 U.S. 319, 109 S.Ct. 1827, 104 L.Ed.2d 338 (1989).
[6]  For example, with regard to the alleged opening of inmate mail outside of the inmate's presence, the United States Court of Appeals for the Third Circuit in Jones v. Brown, 461 F.3d 353 (3rd Cir.2006), found that the policy of opening legal mail outside the presence of the addressee prisoner impinged upon the prisoner's right to freedom of speech under the First Amendment, and that the legal mail policy of the state prison was not reasonably related to the prison's legitimate penological interest in protecting the health and safety of prisoners and staff.
[7]  For example, Bailey cites 37 Pa.Code § 93.12, which provides, in relevant part:

Every institution will establish procedures to permit inmates to have access to health care professionals, prescribed treatment for serious medical needs, appropriate nutrition, exercise and personal hygiene items.
[8]  In Maute v. Frank, an inmate filed a mandamus action seeking to practice his Native American religion and have access to related religious items in his cell. In examining whether a clear right to relief and mandatory duty were present, this Court reasoned that "[t]he mere fact that whether religious articles are permitted is balanced against the need for orderly administration of the prison makes it a discretionary act and not a ministerial one, making mandamus not maintainable." 670 A.2d at 740.
[9]  Based on how we have decided the outcome of this matter, we need not address the Department's argument that the complaint should be dismissed under the "three strikes rule" contained in the Prison Litigation Reform Act, 42 Pa.C.S. § 6602(f).
