Skip to content

Commit

Permalink
KSM-554 Added new and updated PAM field types (#653)
Browse files Browse the repository at this point in the history
  • Loading branch information
idimov-keeper authored Sep 11, 2024
1 parent b53aee9 commit 0298b1f
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 8 deletions.
122 changes: 116 additions & 6 deletions sdk/python/helper/keeper_secrets_manager_helper/v3/field_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ class Multiline(FieldType):
name = "multiline"


# "file" - obsolete and removed legacy field - "fldt_file": { key: 'file_or_photo', default: "File or Photo" },
class FileRef(FieldType):
name = "fileRef"
# The validation checks to see if value is a Record UID.
Expand Down Expand Up @@ -678,16 +679,12 @@ class Host(FieldType):
}
}

# AppFiller?


class LicenseNumber(FieldType):
name = "licenseNumber"
schema = {"value_type": str, "desc": "License Number"}


# privateKey?

class SecureNote(FieldType):
name = "note"
schema = {"value_type": str, "desc": "Secret Note"}
Expand All @@ -705,7 +702,10 @@ class Schedule(FieldType):
"value_type": dict,
"schema": {
"type": {"value_type": str, "desc": "Type"},
"utcTime": {"value_type": str, "desc": "UTC Timestamp"},
"cron": {"value_type": str, "desc": "Crontab format string"},
# "utcTime" - replaced by time and tz
"time": {"value_type": str, "desc": "Time"},
"tz": {"value_type": str, "desc": "Time zone"},
"weekday": {"value_type": str, "desc": "Day of the Week"},
"intervalCount": {"value_type": int, "desc": "Interval Count"}
}
Expand Down Expand Up @@ -740,7 +740,16 @@ class PamResources(FieldType):
"schema": {
"controllerUid": {"value_type": str, "desc": "Record UID of the Controller Record"},
"folderUid": {"value_type": str, "desc": "Folder UID"},
"resourceRef": {"value_type": list, "desc": "List with UIDs of resource records"}
"resourceRef": {"value_type": list, "desc": "List with UIDs of resource records"},
"allowedSettings": {
"value_type": dict, "desc": "List with allowed settings flags",
"schema": {
"connections": {"value_type": bool},
"portForwards": {"value_type": bool},
"rotation": {"value_type": bool},
"sessionRecording": {"value_type": bool},
"typescriptRecording": {"value_type": bool}
}},
}
}

Expand Down Expand Up @@ -785,3 +794,104 @@ class Script(FieldType):
"recordRef": {"value_type": str, "validate": UID_REGEX, "desc": "Record UID of the referenced record."}
}
}


class IsSSIDHidden(FieldType):
name = "isSSIDHidden"
schema = {"value_type": bool, "desc": "Is SSID Hidden"}


class WifiEncryption(FieldType):
name = "wifiEncryption"


class Dropdown(FieldType):
name = "dropdown"


class RbiUrl(FieldType):
name = "rbiUrl"


class AppFiller(FieldType):
name = "appFiller"
schema = {
"value_type": dict,
"schema": {
"applicationTitle": {"value_type": str, "desc": "Application Title"},
"contentFilter": {"value_type": str, "desc": "Content Filter"},
"macroSequence": {"value_type": str, "desc": "Macro Sequence"},
}
}


class PamRemoteBrowserSettings(FieldType):
name = "pamRemoteBrowserSettings"
schema = {
"value_type": dict,
"schema": {
"connection": {
"value_type": dict,
"desc": "Connection details",
"schema": {
"protocol": {"value_type": str},
"enabled": {"value_type": bool},
"user_records": {"value_type": list},
"allow-url-manipulation": {"value_type": bool},
"allowed-url-patterns": {"value_type": str},
"allowed-resource-url-patterns": {"value_type": str},
"http-credentials-uid": {"value_type": str},
"autofill-configuration": {"value_type": str}
}
},
}
}


class PamSettings(FieldType):
name = "pamSettings"
schema = {
"value_type": dict,
"schema": {
"connection": {
"value_type": dict,
"desc": "PAM Settings",
"schema": {
"configUid": {"value_type": str},
"adminCredentialUid": {"value_type": str},
"portForward": {
"value_type": list,
"desc": "Port Settings",
"schema": {
"enabled": {"value_type": bool},
"reusePort": {"value_type": bool},
"port": {"value_type": str},
}
},
"connection": {
"value_type": list,
"desc": "Connection Settings",
"schema": {
"protocol": {"value_type": str},
"enabled": {"value_type": bool},
"user_records": {"value_type": list},
"security": {"value_type": str},
"ignore-cert": {"value_type": bool},
"resize-method": {"value_type": str},
"color-scheme": {"value_type": str}
}
},
}
},
}
}


class TrafficEncryptionSeed(FieldType):
name = "trafficEncryptionSeed"


# List of retired field types:
# trafficEncryptionKey - replaced by trafficEncryptionSeed
# pamProvider - deprecated for legacy/internal use only
# controller - deprecated for legacy/internal use only
5 changes: 3 additions & 2 deletions sdk/python/helper/tests/v3/v3_field_type_all_fields_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,11 @@ def test_record_ref(self):
def test_schedule(self):
ft = Schedule()
ft.type = "WEEKLY"
ft.utcTime = "00:00"
ft.time = "00:00:00"
ft.tz = "America/Chicago"
ft.weekday = "WEDNESDAY"
ft.intervalCount = 1
self._check_dict(ft, value={"type": "WEEKLY", "utcTime": "00:00", "weekday": "WEDNESDAY", "intervalCount": 1})
self._check_dict(ft, value={"type": "WEEKLY", "time": "00:00:00", "tz": "America/Chicago", "weekday": "WEDNESDAY", "intervalCount": 1})

def test_directory_type(self):
ft = DirectoryType()
Expand Down

0 comments on commit 0298b1f

Please sign in to comment.