| 116 | |
| 117 | |
| 118 | def _parse_fields(obj: Dict, type: str, tmpl=None): |
| 119 | templates = { |
| 120 | "rs":{ |
| 121 | "title":"", |
| 122 | "host":"", |
| 123 | "type":"pamMachine", |
| 124 | "pam_settings": { |
| 125 | "options": { |
| 126 | "rotation": "off", |
| 127 | "connections": "on", |
| 128 | "tunneling": "off", |
| 129 | "graphical_session_recording": "on" |
| 130 | }, |
| 131 | "connection":{} |
| 132 | }, |
| 133 | "users": [] |
| 134 | }, |
| 135 | "usr":{ |
| 136 | "rotation_settings": {} |
| 137 | } |
| 138 | } |
| 139 | res = copy.deepcopy(tmpl) if tmpl else copy.deepcopy(templates.get(type, {})) |
| 140 | |
| 141 | for key in obj: |
| 142 | if obj[key] == "": continue |
| 143 | if key.startswith(type): |
| 144 | split_arg = key.split(".") |
| 145 | if len(split_arg)==2: |
| 146 | res[split_arg[1]] = obj[key] |
| 147 | elif len(split_arg)==3: |
| 148 | res[split_arg[1]][split_arg[2]] = obj[key] |
| 149 | elif len(split_arg)==4: |
| 150 | res[split_arg[1]][split_arg[2]][split_arg[3]] = obj[key] |
| 151 | return res |
| 152 | |
| 153 | |
| 154 | def _gen_data(csv_data: List[Dict[str, str]], |