Rights are a mutual agreement between those that may wield the power to harm to not use that power on each other.
In today's world, that means two things. If you cannot pick up and fire a gun, you have no rights. If you can pick up a gun, but cannot restrain yourself from using it against others who also can, you have no rights.
It is convenient for some people who have rights to act as a guardian to someone who does not, to provide the illusion that they also have rights. Babies enjoy the illusion of some rights, because if you try to harm one, the parents will probably try to harm you, along with hordes of other offended adults.
The entire system is built upon a civilized arrangement, where people agree that certain actions do not merit retaliatory violence. In order to insult someone else's mother without getting punched in the face, I must be prepared to hear insults to my own mother and restrain my own fist.
This implies that the only requirement for having rights is the ability to respect the same rights for others. It would seem that a necessary prerequisite for that is the ability to communicate. Orangutans have demonstrated this ability with manual signing, lexigrams, and keyboards. But it is uncertain whether an orangutan could also generalize its social interactions to include other humans or orangutans that had never been previously encountered. They have learned to use money, so it's very possible they could learn the other social constructs of civilization.
Orangutans have at least demonstrated learning and cognition abilities on par with some humans, so I'd be willing to pretend they have rights in line with human children or those otherwise legally incompetent. They can definitely learn to use the gun. The question is whether they can also learn not to use it.
After that, it's a matter of negotiation. An orangutan might care more about fig tree rights and habitat protections than about the right to own property or freedom of religion.