Marriage, properly defined, is a right.
However, same-sex unions are in no sense marriages.
The Church does not have the authority to forbid a man or woman to marry, because it is a natural right based on natural law. That is why priestly celibacy is always described such that the Church (in the Latin Rite) only chooses men who have freely chosen not to marry to become priests, rather than that the Church forbids certain persons to marry.
However, same-sex unions are contrary to natural law, and so are not rights and are not marriages.
There are certain impediments to marriage which take precedence over the right, for the right is not absolute. There is a right to life, but if one commits a very serious crime, the death penalty is sometimes a moral punishment. The impediments to natural marriage are either inherent or juridicial. A government can reasonably set limits on natural marriage such as age limits, blood tests for diseases, marriage licenses, etc. – all of which would be juridicial and to some extent dispensable. Inherent impediments to a natural marriage would include when both persons are of the same gender. The government does not have the ability to dispense from a natural impediment, since marriage is by its very nature the union of one man and one woman.
There are also impediments to marriage as a Sacrament, both inherent, which even the Church cannot dispense from, and juridicial, which are governed by Church Law. It is likewise inherent to marriage as a Sacrament that the union be only of one man and one woman. The Church does not have the ability or authority to dispense from this requirement.