This commit is contained in:
wh1te909 2024-11-15 20:19:00 +00:00
parent 63947346e9
commit 150e3190bc
2 changed files with 4 additions and 6 deletions

View File

@ -96,9 +96,7 @@ class GetAddSSOProvider(APIView):
# removed any special characters and replaces spaces with a hyphen # removed any special characters and replaces spaces with a hyphen
def generate_provider_id(self, string): def generate_provider_id(self, string):
id = re.sub(r"[^A-Za-z0-9\s]", "", string) return re.sub(r"[^A-Za-z0-9\s]", "", string).replace(" ", "-")
id = id.replace(" ", "-")
return id
def post(self, request): def post(self, request):
data = request.data data = request.data
@ -106,7 +104,7 @@ class GetAddSSOProvider(APIView):
# need to move server_url into json settings # need to move server_url into json settings
data["settings"] = {} data["settings"] = {}
data["settings"]["server_url"] = data["server_url"] data["settings"]["server_url"] = data["server_url"]
data["settings"]["role"] = data["role"] if data["role"] else None data["settings"]["role"] = data["role"] or None
# set provider to 'openid_connect' # set provider to 'openid_connect'
data["provider"] = "openid_connect" data["provider"] = "openid_connect"
@ -138,7 +136,7 @@ class GetUpdateDeleteSSOProvider(APIView):
# need to move server_url into json settings # need to move server_url into json settings
data["settings"] = {} data["settings"] = {}
data["settings"]["server_url"] = data["server_url"] data["settings"]["server_url"] = data["server_url"]
data["settings"]["role"] = data["role"] if data["role"] else None data["settings"]["role"] = data["role"] or None
serializer = self.InputSerialzer(instance=provider, data=data, partial=True) serializer = self.InputSerialzer(instance=provider, data=data, partial=True)
serializer.is_valid(raise_exception=True) serializer.is_valid(raise_exception=True)

View File

@ -474,7 +474,7 @@ class PendingAction(models.Model):
PAAction.RUN_PATCH_SCAN, PAAction.RUN_PATCH_SCAN,
PAAction.RUN_PATCH_INSTALL, PAAction.RUN_PATCH_INSTALL,
): ):
return f"{self.action_type}" return str(self.action_type)
return None return None