Police need a warrant before they can search a home, unless an exception applies. One exception is consent: If someone with control over the property agrees to a police search request, the subsequent search is probably legal. Someone with "control" over the property includes a resident of the home, but not someone who is clearly a momentary visitor.
Even when it's clear that someone has authority to consent to a police search, that person doesn't necessarily have authority to allow the police to search all parts of the home. This issue frequently arises with roommates, who might share certain areas of the home but not others, like their bedrooms. And that's where the only roommate who's home agrees to the police search—if another roommate is also home and refuses to give consent, the police might not be able to conduct any kind of search at all.
(Keep in mind that, even though rules tend to be pretty consistent throughout the country, the law in the jurisdiction will control in any case.)
The police can enter a home when only one occupant of several is present and consents—the agreement of any other occupant typically isn't needed. For example, if college students Alex and Brian share an apartment and the police ask to enter when only Alex is home, his consent is all that's needed to make their entry legal.
But the outcome is different if another occupant is home and objects to the search. If two occupants are present, one consents, and the other objects, the police usually can't search the residence. Physical presence is key, however: The Supreme Court confirmed in 2014 that the objecting occupant must be present in order to prevent the search. (Georgia v. Randolph, 547 U. S. 103 (2006); Fernandez v. California, 571 U.S. __ (2014).)
Example 1: Wallace and Bodie share an apartment as roommates. The police, responding to a neighbor's noise complaint, knock on the apartment door. Only Wallace is home. When he answers the door, the officers ask him whether they can come in and look around. He says yes. Even though Bodie isn't around and hasn't consented, the police are authorized to come in and have a look.
Example 2: The police knock on the door, and Wallace answers. This time, however, Bodie is home. He hears Wallace, who agrees to let the officers in, talking to them. He rushes to the door and tells the officers, "You can't come in. I don't consent to you entering my home." The officers aren't allowed to come into the apartment.
Example 3: After speaking with Wallace and Bodie and determining that they can't search the apartment, the officers leave. Two hours later, they come back and knock again. Bodie has stepped out from the apartment since they were last there, so Wallace is the only one home. He consents to the officers coming in and taking a look. Even though Bodie had been present and recently objected to a police search, the officers are now entitled to look around.
Assuming they have the consent of the only roommate who is present, the police may normally inspect all parts of the home that he or she uses. So, they can search any part of the premises the consenting party occupies (such as that person's private room) and any areas of the home where all roommates or tenants have access. Shared areas generally include places like the living room and kitchen.
Importantly, though, the police generally cannot search the private room or belongings of a person who, either present or not, did not grant consent. To determine whether the police may search a specific part of a home, courts evaluate whether the person who granted consent has access to and authority over it. To return to our example of Alex and Brian, the police would not have authority to search Brian's bedroom if that room were his alone and not one Alex had use of.
When only one roommate is around and grants consent for the police to perform a search, courts often look at the relationship and understanding between the roommates to decide how much of the home the police were authorized to examine. For example, searching an entire residence would be justified if the roommates were romantic partners—the assumption is that no areas of the home were off-limits to either partner. But if the occupants are simply roommates or cotenants and the one talking to the police doesn't have permission to use or access another's bedroom, then that bedroom is off-limits. On the other hand, if Alex and Brian, starving students that they are, can afford only a one-bedroom apartment, then the bedroom and closet that they share means that the consent of one will probably permit the police to search the shared space.
With almost all search issues, the issue is as much how the circumstances reasonably appeared to the police as it is who actually has access to and uses what in the home.