def get(self, request, *args, **kwargs): all_services_list = [] eid = request.user.enterprise_id service = oauth_repo.get_conosle_oauth_service(eid) all_services = oauth_repo.get_all_oauth_services(eid) if all_services is not None: for l_service in all_services: api = get_oauth_instance(l_service.oauth_type, service, None) authorize_url = api.get_authorize_url() all_services_list.append({ "service_id": l_service.ID, "enable": l_service.enable, "name": l_service.name, "client_id": l_service.client_id, "auth_url": l_service.auth_url, "redirect_uri": l_service.redirect_uri, "oauth_type": l_service.oauth_type, "home_url": l_service.home_url, "eid": l_service.eid, "access_token_url": l_service.access_token_url, "api_url": l_service.api_url, "client_secret": l_service.client_secret, "is_auto_login": l_service.is_auto_login, "is_git": l_service.is_git, "authorize_url": authorize_url, "enterprise_id": l_service.eid, }) rst = {"data": {"list": all_services_list}} return Response(rst, status=status.HTTP_200_OK)
def get(self, request): user = request.user queryset = config_service.initialization_or_get_config() oauth_services = [] services = oauth_repo.get_all_oauth_services(str(user.enterprise_id)) for service in services: oauth_services.append( { "service_id": service.ID, "enable": service.enable, "name": service.name, "client_id": service.client_id, "auth_url": service.auth_url, "redirect_uri": service.redirect_uri, "oauth_type": service.oauth_type, "is_console": service.is_console, "home_url": service.home_url, "eid": service.eid, "access_token_url": service.access_token_url, "api_url": service.api_url, "client_secret": service.client_secret, "is_auto_login": service.is_auto_login } ) queryset["oauth_services"]["value"] = oauth_services serializer = FeatureConfigRespSerializer(queryset) return Response(serializer.data)