public function userHasRoles( core_kernel_classes_Resource $user, $roles)
    {
        $returnValue = (bool) false;

    	if (empty($roles)){
        	throw new InvalidArgumentException('The $roles parameter must not be empty.');	
        }
        
    	$roles = (is_array($roles)) ? $roles : array($roles);
    	$searchRoles = array();
    	foreach ($roles as $r){
    		$searchRoles[] = ($r instanceof core_kernel_classes_Resource) ? $r->getUri() : $r;
    	}
    	unset($roles);
    	
        if (common_session_SessionManager::getSession()->getUserUri() == $user->getUri()){
            foreach (common_session_SessionManager::getSession()->getUserRoles() as $role) {
                if (in_array($role, $searchRoles)) {
                    $returnValue = true;
                    break;
                }
            }
        } else {
    	    // After introducing remote users, we can no longer guarantee that any user and his roles are available
        	common_Logger::w('Roles of non current user ('.$user->getUri().') checked, trying fallback to local ontology');	
        	$userRoles = array_keys($this->getUserRoles($user));
        	$identicalRoles = array_intersect($searchRoles, $userRoles);
        	
        	$returnValue = (count($identicalRoles) === count($searchRoles));
        }
    	
        return (bool) $returnValue;
    }