Add NSF support for PAM config/rotation and KSM; drop duplicate rotation sync#212
Add NSF support for PAM config/rotation and KSM; drop duplicate rotation sync#212mtyagi-ks wants to merge 9 commits into
Conversation
| return None | ||
| folder_uid = folder_uids[0] | ||
| if folder_uid == nsf_management.ROOT_FOLDER_UID: | ||
| return _PamFolderRef('My Drive', folder_uid) |
There was a problem hiding this comment.
change it to 'My Vault'
| record_uid = nsf_management.resolve_nsf_record_uid(vault, identifier) | ||
| except nsf_management.NsfError: | ||
| record_uid = None | ||
| if not record_uid: |
There was a problem hiding this comment.
move this check before checking for records, move it to line 242
There was a problem hiding this comment.
identifier is already validated above, so moving if not record_uid before get_record would be dead code. The post-resolve None check is the one that matters and should stay after resolve
| return None | ||
|
|
||
| def _find_nsf_pam_configurations(self, vault: vault_online.VaultOnline): | ||
| """Yield TypedRecord PAM configs stored under NSF / Keeper Drive.""" |
There was a problem hiding this comment.
remove drive mention from anywhere in the code
| common_parser.add_argument('--shared-folder', '-sf', dest='shared_folder_uid', action='store', | ||
| help='Share Folder where this PAM Configuration is stored. Should be one of the folders to ' | ||
| 'which the gateway has access to.') | ||
| help='Classic shared folder or NSF / Keeper Drive folder (UID or name) where this PAM ' |
There was a problem hiding this comment.
remove keeper drive mention
| record_uid = nsf_management.resolve_nsf_record_uid(vault, identifier) | ||
| except nsf_management.NsfError: | ||
| record_uid = None | ||
| if not record_uid: |
There was a problem hiding this comment.
move record uid check to line 1200
There was a problem hiding this comment.
identifier is already validated above, so moving if not record_uid before get_record would be dead code. The post-resolve None check is the one that matters and should stay after resolve
| resource_id = utils.base64_url_encode(rri.resourceUid) | ||
| resource_ok = is_resource_ok(resource_id, vault, configuration_uid) | ||
| logger.info(f"Admin Resource Uid: {resource_id if resource_ok else 'FAIL'}") | ||
| # Always print the router resource UID (Commander parity). Do not |
| if not self._auth or not self._auth.auth_context.is_enterprise_admin: | ||
| return | ||
| if self._enterprise_loader is None: | ||
| """Copy rotations from the last vault sync into :attr:`pam_plugin` sqlite (no extra sync_down).""" |
| self._record_rotations.put_entities(_pam_rotation_to_domain(r) for r in row_list) | ||
|
|
||
| def sync_down(self, *, reload: bool = False) -> None: | ||
| """Refresh controllers from PAM API; reload rotations from local sqlite only.""" |
| if not uids_to_update: | ||
| classic_uids_to_readd.append(uid) | ||
|
|
||
| if classic_uids_to_readd: |
There was a problem hiding this comment.
correct typo from definition till here
| def consume_rotations_cleared(self) -> bool: | ||
| """Return and clear the 'last sync cleared rotations' flag for PAM sqlite replace.""" | ||
| cleared = self._pending_rotation_replace | ||
| self._pending_rotation_replace = False |
There was a problem hiding this comment.
this clears the cache and rebuild from sqlite?
There was a problem hiding this comment.
this only returns and clears the _pending_rotation_replace flag (one-shot). The in-memory rotation cache is cleared during sync_down / _ingest_record_rotations. PAM sqlite replace vs merge is decided later by the CLI using this flag as replace_all.
| *, | ||
| is_editable: bool = False, | ||
| request_sync: bool = True) -> Dict[str, Any]: | ||
| """Share an NSF (Keeper Drive) folder with a KSM application via AT_APPLICATION. |
| request_sync: bool = True) -> Dict[str, Any]: | ||
| """Share an NSF (Keeper Drive) folder with a KSM application via AT_APPLICATION. | ||
|
|
||
| Classic vault/app_share_add rejects Drive folders; this uses folders/v3/access_update. |
| return sf_uid | ||
|
|
||
|
|
||
| if vault.nsf_data is None: |
Summary
sync_downused only for rotations.Test plan
pam config list/pam config new/pam config editwork for NSF PAM configspam rotation list/inforesolve NSF pamUser, config, and resource titles/UIDspam rotation editagainst NSF pamUser (confirm revision behavior after sync)