Skip to content

Commit

Permalink
Fixed user attributes error handling by dumping to json before return
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed Jan 25, 2023
1 parent a4d7b1c commit d8a4114
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion active-directory/1.0.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Get-ADDomain
3. Find the response from "UsersContainer" and use this for Base DN and Search Base

## Typical issues
- InvalidCredentials: This happens when the credentials are wrong.
- InvalidCredentials: This happens when the credentials are wrong. See #authentication to understand if your format for your username/password is correct.

## Features
get user attributes -- done
Expand Down
9 changes: 5 additions & 4 deletions active-directory/1.0.0/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,17 @@ def user_attributes(

result = json.loads(c.response_to_json())
if len(result["entries"]) == 0:
return {
return json.dumps({
"success": False,
"result": result,
"reason": "No user found for %s" % samaccountname,
}
})

except Exception as e:
return {
return json.dumps({
"success": False,
"reason": "Failed to get users in user attributes: %s" % e,
}
})


result = result["entries"][0]
Expand Down
2 changes: 1 addition & 1 deletion email/1.2.0/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ actions:
description: Include raw body in email export
multiline: false
options:
- "false"
- "true"
- "false"
required: true
schema:
type: bool
Expand Down
7 changes: 7 additions & 0 deletions shuffle-tools/1.2.0/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,14 @@ def execute_bash(self, code, shuffle_input):
def filter_list(self, input_list, field, check, value, opposite):
self.logger.info(f"\nRunning function with list {input_list}")

# Remove hashtags on the fly
# E.g. #.fieldname or .#.fieldname

flip = False
if str(opposite).lower() == "true":
flip = True


try:
#input_list = eval(input_list) # nosec
input_list = json.loads(input_list)
Expand All @@ -590,6 +594,9 @@ def filter_list(self, input_list, field, check, value, opposite):

input_list = [input_list]

if str(value).lower() == "null":
value = "none"

self.logger.info(f"\nRunning with check \"%s\" on list of length %d\n" % (check, len(input_list)))
found_items = []
new_list = []
Expand Down

0 comments on commit d8a4114

Please sign in to comment.