-
Notifications
You must be signed in to change notification settings - Fork 84
PAM Workflow changes and improvements #2019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
amangalampalli-ks
wants to merge
6
commits into
fix/pam-workflow-changes
Choose a base branch
from
fix/pam-workflow-changes-int
base: fix/pam-workflow-changes
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0e29a6e
Implement workflow recent changes after apr 22
amangalampalli-ks 8dea82a
Remove flow uid support in state
amangalampalli-ks 51b40ec
Remove column from my-access and fix mfa prompts
amangalampalli-ks 6b9aeea
Fix flow uids starting with - and my-access table view
amangalampalli-ks db77fc4
Add record type validation for workflows
amangalampalli-ks 2b48148
Add better error handling
amangalampalli-ks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,8 +83,6 @@ class WorkflowCreateCommand(Command): | |
| help='Comma-separated allowed days (e.g., "mon,tue,wed,thu,fri")') | ||
| parser.add_argument('--time-range', type=str, | ||
| help='Allowed time range in HH:MM-HH:MM format (e.g., "09:00-17:00")') | ||
| parser.add_argument('--timezone', type=str, | ||
| help='Timezone for allowed times (e.g., "America/New_York")') | ||
| parser.add_argument('-u', '--approver', action='append', | ||
| help='User email to add as an approver. Pass multiple times to ' | ||
| 'add several. Required when --approvals-needed > 0. ' | ||
|
|
@@ -97,6 +95,7 @@ def get_parser(self): | |
|
|
||
| def execute(self, params: KeeperParams, **kwargs): | ||
| record_uid, record = RecordResolver.resolve(params, kwargs.get('record')) | ||
| RecordResolver.validate_workflow_record_type(record) | ||
| record_uid_bytes = utils.base64_url_decode(record_uid) | ||
|
|
||
| # Pre-check: surface the "already exists" condition with a clear, | ||
|
|
@@ -155,7 +154,7 @@ def execute(self, params: KeeperParams, **kwargs): | |
| parameters.accessLength = WorkflowFormatter.parse_duration(kwargs.get('duration', '1d')) | ||
|
|
||
| temporal_filter = WorkflowFormatter.build_temporal_filter( | ||
| kwargs.get('allowed_days'), kwargs.get('time_range'), kwargs.get('timezone'), | ||
| kwargs.get('allowed_days'), kwargs.get('time_range'), | ||
| ) | ||
| if temporal_filter: | ||
| parameters.allowedTimes.CopyFrom(temporal_filter) | ||
|
|
@@ -386,8 +385,6 @@ class WorkflowUpdateCommand(Command): | |
| help='Comma-separated allowed days (e.g., "mon,tue,wed,thu,fri")') | ||
| parser.add_argument('--time-range', type=str, | ||
| help='Allowed time range in HH:MM-HH:MM format (e.g., "09:00-17:00")') | ||
| parser.add_argument('--timezone', type=str, | ||
| help='Timezone for allowed times (e.g., "America/New_York")') | ||
| parser.add_argument('--format', dest='format', action='store', | ||
| choices=['table', 'json'], default='table', help='Output format') | ||
|
|
||
|
|
@@ -434,7 +431,7 @@ def execute(self, params: KeeperParams, **kwargs): | |
| updates_provided = True | ||
|
|
||
| temporal_filter = WorkflowFormatter.build_temporal_filter( | ||
| kwargs.get('allowed_days'), kwargs.get('time_range'), kwargs.get('timezone'), | ||
| kwargs.get('allowed_days'), kwargs.get('time_range'), | ||
| ) | ||
| if temporal_filter: | ||
| parameters.allowedTimes.CopyFrom(temporal_filter) | ||
|
|
@@ -456,6 +453,8 @@ def execute(self, params: KeeperParams, **kwargs): | |
| print(f"Record: {record.title} ({record_uid})") | ||
| print() | ||
|
|
||
| except CommandError: | ||
| raise | ||
| except Exception as e: | ||
| raise CommandError('', f'Failed to update workflow: {sanitize_router_error(e)}') | ||
|
|
||
|
|
@@ -582,6 +581,8 @@ def execute(self, params: KeeperParams, **kwargs): | |
| print(f"Type: Escalation approver{esc_info}") | ||
| print() | ||
|
|
||
| except CommandError: | ||
| raise | ||
| except Exception as e: | ||
| raise CommandError('', f'Failed to add approvers: {sanitize_router_error(e)}') | ||
|
|
||
|
|
@@ -642,5 +643,7 @@ def execute(self, params: KeeperParams, **kwargs): | |
| print(f"Removed {total} approver(s)") | ||
| print() | ||
|
|
||
| except CommandError: | ||
| raise | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. raise exceptions for KeyboardInterrupt/SystemExit also |
||
| except Exception as e: | ||
| raise CommandError('', f'Failed to remove approvers: {sanitize_router_error(e)}') | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise exceptions for KeyboardInterrupt/SystemExit also