@rpc4django.rpcmethod(
    name='leop.gs.list',
    signature=['String'],
    login_required=satnet_settings.JRPC_LOGIN_REQUIRED
)
def list_groundstations(launch_id, **kwargs):
    """JRPC method (LEOP service).
    Returns the list of groundstations available for creating this LEOP
    system. In case a Ground Station is already in use for this system, it will
    not be listed.

    # user must be obtained from the request, since this has already been
    # validated by the authentication backend

    :param launch_id: Identifier of the LEOP cluster.
    :param kwargs: Dictionary with additional variables like the HTTP request
                    itself (defined by RPC4Django).
    :return: List of the identifiers of the available groundstations.
    """

    if satnet_settings.JRPC_PERMISSIONS:
        http_request = kwargs.get('request', None)
        if not http_request or not http_request.user.is_staff:
            raise django_ex.PermissionDenied()

    leop_cluster = launch_models.Launch.objects.get(identifier=launch_id)

    # List construction: ground stations in use and available for LEOP
    u_gs = leop_cluster.groundstations.all()
    all_gs = segment_models.GroundStation.objects.all()
    a_gs = [item for item in all_gs if item not in u_gs]

    # Serialization to a JSON-RPC-like object
    return launch_serial.serialize_gs_lists(a_gs, u_gs)
dataset/ETHPy150Open satnet-project/server/services/leop/jrpc/views/launch.py/list_groundstations/original