'Given a list of resources, retrieve the range of settable quotas for
the given user or project.
:param context: The request context, for access checks.
:param resources: A dictionary of the registered resources.
:param project_id: The ID of the project to return quotas for.
:param user_id: The ID of the user to return quotas for.'

def get_settable_quotas(self, context, resources, project_id, user_id=None):

    settable_quotas = {}
    db_proj_quotas = objects.Quotas.get_all_by_project(context, project_id)
    project_quotas = self.get_project_quotas(context, resources, project_id, remains=True, project_quotas=db_proj_quotas)
    if user_id:
        setted_quotas = objects.Quotas.get_all_by_project_and_user(context, project_id, user_id)
        user_quotas = self.get_user_quotas(context, resources, project_id, user_id, project_quotas=db_proj_quotas, user_quotas=setted_quotas)
        for (key, value) in user_quotas.items():
            maximum = self._sum_quota_values(project_quotas[key]['remains'], setted_quotas.get(key, 0))
            minimum = value['in_use']
            settable_quotas[key] = {'minimum': minimum, 'maximum': maximum}
    else:
        for (key, value) in project_quotas.items():
            minimum = max(int(self._sub_quota_values(value['limit'], value['remains'])), int(value['in_use']))
            settable_quotas[key] = {'minimum': minimum, 'maximum': (-1)}
    return settable_quotas
