-
Notifications
You must be signed in to change notification settings - Fork 6
Run as UserID and Error handling changes #57
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
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
12cd2b0
Error and Error Handling Changes
ElijahSwiftIBM f5754c2
Add base functionality to run as another user
ElijahSwiftIBM 721e878
Typing changes
ElijahSwiftIBM a6e53c4
Update irrsmo00.py
ElijahSwiftIBM f4756c7
Surface IRRSMO00 Return and Reason Codes
ElijahSwiftIBM f261c44
Merge branch 'feature/handle-empty-return' into feature/run_as_userid
ElijahSwiftIBM 85e7109
Fold Surrogat Error into Null Response
ElijahSwiftIBM a6e927d
Minor changes for doc
ElijahSwiftIBM 723a381
Refactoring and Standardization Changes
ElijahSwiftIBM a1b9be1
Updates
ElijahSwiftIBM eda3184
Complete Transition to UserIdError
ElijahSwiftIBM 8db616c
Changing error text and formatting
ElijahSwiftIBM 3c594f5
Rearrange Errors
ElijahSwiftIBM 8a227de
add running_user even when not specified
ElijahSwiftIBM 000b71f
Name Changes
ElijahSwiftIBM 04c028d
Naming and Docstring Updates
ElijahSwiftIBM 46be4b8
Naming and convention fixes
ElijahSwiftIBM d05d4c4
Minor changes
ElijahSwiftIBM 2baa080
Minor changes
ElijahSwiftIBM 3c4bee2
Add unit test for Add operations
ElijahSwiftIBM a958401
Docstring changes
ElijahSwiftIBM dbdf9c1
Add Testcase for SetupPrecheck error
ElijahSwiftIBM 2d7c512
Update test_setup_precheck.py
ElijahSwiftIBM 588449f
Update security_admin.py
ElijahSwiftIBM 07c92cc
Change DownstreamFatalError Test Constants
ElijahSwiftIBM f9db7fc
Update irrsmo00.py
ElijahSwiftIBM 37b2214
Update irrsmo00.c
ElijahSwiftIBM 0baee16
Function and Unit Test Changes
ElijahSwiftIBM 19c5df0
Change docstrings and version number
ElijahSwiftIBM af81fc7
Drive userid on get_running_userid to lowercase
ElijahSwiftIBM f4171c2
Update security_admin.py
ElijahSwiftIBM 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
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 |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| """Exception to use when IRRSMO00 is unable to process a request.""" | ||
| from typing import Union | ||
|
|
||
|
|
||
| class DownstreamFatalError(Exception): | ||
| """ | ||
| Raised when IRRSMO00 returns with a SAF Return Code of 8, | ||
| indicating that the request could not be processed. | ||
| """ | ||
|
|
||
| def __init__( | ||
| self, | ||
| saf_return_code: int, | ||
| racf_return_code: int, | ||
| racf_reason_code: int, | ||
| request_xml: bytes, | ||
| run_as_userid: Union[str, None] = None, | ||
| result_dictionary: dict = None, | ||
| ) -> None: | ||
| self.message = "Security request made to IRRSMO00 failed." | ||
| self.saf_return_code = saf_return_code | ||
| self.racf_return_code = racf_return_code | ||
| self.racf_reason_code = racf_reason_code | ||
| self.request_xml = request_xml.decode("utf-8") | ||
| self.message += ( | ||
| f"\n\nSAF Return Code: {self.saf_return_code}\nRACF Return Code:" | ||
| + f" {self.racf_return_code}\nRACF Reason Code: {self.racf_reason_code}" | ||
| ) | ||
| if result_dictionary is not None: | ||
| self.message += ( | ||
| "\n\nSee results dictionary " | ||
| + f"'{self.__class__.__name__}.result' for more details.\n" | ||
| + "\n\nYou can also check the specified return and reason codes against " | ||
| + "the documented IRRSMO00 return and reason codes for more information " | ||
| + "about this error.\n" | ||
| + "https://www.ibm.com/docs/en/zos/3.1.0?topic=operations-return-reason-codes" | ||
| ) | ||
| self.result = result_dictionary | ||
| elif ( | ||
| (self.saf_return_code == 8) | ||
| and (self.racf_return_code == 200) | ||
| and (self.racf_reason_code == 16) | ||
| ): | ||
| self.message += ( | ||
| "\n\nCheck to see if the proper RACF permissions are in place.\n" | ||
| + "For 'set' or 'alter' functions, you must have at least 'READ' " | ||
| + "access to 'IRR.IRRSMO00.PRECHECK' in the 'XFACILIT' class." | ||
| ) | ||
| elif ( | ||
| (self.saf_return_code == 8) | ||
| and (self.racf_return_code == 200) | ||
| and (self.racf_reason_code == 8) | ||
| ): | ||
| self.message += ( | ||
| "\n\nCheck to see if the proper RACF permissions are in place.\n" | ||
| + "For the 'run_as_userid' feature, you must have at least 'UPDATE' " | ||
| + f"access to '{run_as_userid.upper()}.IRRSMO00' in the 'SURROGAT' class." | ||
| ) | ||
| else: | ||
| self.message += ( | ||
| "\n\nPlease check the specified return and reason codes against " | ||
| + "the documented IRRSMO00 return and reason codes for more information " | ||
| + "about this error.\n" | ||
| + "https://www.ibm.com/docs/en/zos/3.1.0?topic=operations-return-reason-codes" | ||
| ) | ||
| self.message = f"({self.__class__.__name__}) {self.message}" | ||
|
|
||
| def __str__(self) -> str: | ||
| return self.message | ||
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
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.
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.