public ModifyFederationResponse SetFederateState(ModifyFederationRequest request, FederateState state) { ModifyFederationResponse response = new ModifyFederationResponse(); response.status = -1; response.message = "Not implemented"; //check for collisions in the names of the services FederateRecord fr = mFederateRegister.GetFederateRecord(request.NamespacePrefix); if (fr.namespacePrefix == request.NamespacePrefix || request.NamespacePrefix == AdminUsername ) { if ((fr.OrganizationPOCEmail == request.OrganizationPOCEmail && fr.OrganizationPOCPassword == request.OrganizationPOCPassword) || request.OrganizationPOCEmail == AdminUsername && request.OrganizationPOCPassword == AdminPassword) { if (state == FederateState.Delisted) { if (fr.ActivationState == FederateState.Delisted) { response.message = "Federate at " + fr.RESTAPI + " has already been delisted. Please contact the administrator if you would like to re-enable the account."; return response; } else { fr.ActivationState = FederateState.Delisted; mFederateRegister.UpdateFederateRecord(fr); response.message = "Federate at " + fr.RESTAPI + " has been delisted. The namespace " + fr.namespacePrefix + " will be reserved for this account in the future."; return response; } } if (state == FederateState.Active) { if (fr.ActivationState == FederateState.Active) { response.message = "Federate at " + fr.RESTAPI + " is already active."; return response; } else if (fr.ActivationState == FederateState.Offline) { fr.ActivationState = FederateState.Active; mFederateRegister.UpdateFederateRecord(fr); response.message = "Federate at " + fr.RESTAPI + " has been set as online."; return response; } else { response.message = "Federate at " + fr.RESTAPI + " is awaiting admin approval, and cannot be set as online"; return response; } } if (state == FederateState.Offline) { if (fr.ActivationState == FederateState.Offline) { response.message = "Federate at " + fr.RESTAPI + " is already offline."; return response; } else if (fr.ActivationState == FederateState.Active) { fr.ActivationState = FederateState.Offline; mFederateRegister.UpdateFederateRecord(fr); response.message = "Federate at " + fr.RESTAPI + " has been set as offline."; return response; } else { response.message = "Federate at " + fr.RESTAPI + " is awaiting admin approval, and cannot be set as offline"; return response; } } } else { response.message = "Incorrect Password"; return response; } } else { response.message = "Wrong user for this namespace"; return response; } response.message = "Namespace not found"; return response; }
public ModifyFederationResponse SetFederateState(ModifyFederationRequest request, FederateState state) { ModifyFederationResponse response = new ModifyFederationResponse(); response.status = -1; response.message = "Not implemented"; //check for collisions in the names of the services FederateRecord fr = mFederateRegister.GetFederateRecord(request.NamespacePrefix); if (fr.namespacePrefix == request.NamespacePrefix || request.NamespacePrefix == AdminUsername) { if ((fr.OrganizationPOCEmail == request.OrganizationPOCEmail && fr.OrganizationPOCPassword == request.OrganizationPOCPassword) || request.OrganizationPOCEmail == AdminUsername && request.OrganizationPOCPassword == AdminPassword) { if (state == FederateState.Delisted) { if (fr.ActivationState == FederateState.Delisted) { response.message = "Federate at " + fr.RESTAPI + " has already been delisted. Please contact the administrator if you would like to re-enable the account."; return(response); } else { fr.ActivationState = FederateState.Delisted; mFederateRegister.UpdateFederateRecord(fr); response.message = "Federate at " + fr.RESTAPI + " has been delisted. The namespace " + fr.namespacePrefix + " will be reserved for this account in the future."; return(response); } } if (state == FederateState.Active) { if (fr.ActivationState == FederateState.Active) { response.message = "Federate at " + fr.RESTAPI + " is already active."; return(response); } else if (fr.ActivationState == FederateState.Offline) { fr.ActivationState = FederateState.Active; mFederateRegister.UpdateFederateRecord(fr); response.message = "Federate at " + fr.RESTAPI + " has been set as online."; return(response); } else { response.message = "Federate at " + fr.RESTAPI + " is awaiting admin approval, and cannot be set as online"; return(response); } } if (state == FederateState.Offline) { if (fr.ActivationState == FederateState.Offline) { response.message = "Federate at " + fr.RESTAPI + " is already offline."; return(response); } else if (fr.ActivationState == FederateState.Active) { fr.ActivationState = FederateState.Offline; mFederateRegister.UpdateFederateRecord(fr); response.message = "Federate at " + fr.RESTAPI + " has been set as offline."; return(response); } else { response.message = "Federate at " + fr.RESTAPI + " is awaiting admin approval, and cannot be set as offline"; return(response); } } } else { response.message = "Incorrect Password"; return(response); } } else { response.message = "Wrong user for this namespace"; return(response); } response.message = "Namespace not found"; return(response); }