I think it is under certain conditions, as follows (this is a simplification, but some simplification is needed);
1 - That the side we're fighting on has majority support. Given that at his low point Gadaffi only really had his hometown of Sirte and central Tripoli under his control, in a country where he's controlled the media for forty years, we can safely say that his support is really very limited.
2 - That we were asked to go in. The rebels explicitly asked for the airstrikes that have now been implemented.
3 - That we make every effort to minimise civilian casualties, do not attack targets that do not pose a threat, and concentrate on it as a purely military operation.
4 - That international law expressly allows the action to take place.
To my mind, as the rebels express the vast majority (anti-Gadaffi) view, I consider them a more legitimate authority than Gadaffi for Libya. Given that, plus the use of unprincipled and deadly assaults by Gadaffi's forces, plus a United Nations resolution being passed which essentially urges UN members to protect Libyan civilians, I think that we have every right to comply with their request for assistance.
Bahrain is different. The government only has minority support, the protesters are unarmed and being suppressed by police & troops. The Saudis do not have a right to enter in that case, because whilst part 2 was fulfilled part 1 most certainly wasn't and nor was 3. Let alone 4. Those are the critical differences between the two operations.