Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def access_check_command(accounts, config, args):
"""Check who has access"""
# Find resource types that match the given ARN
resource_type_matches = parliament.get_resource_type_matches_from_arn(
args.resource_arn
)
if len(resource_type_matches) == 0:
raise Exception("Unknown ARN type for {}".format(args.resource_arn))
# Find privileges that match this resource type
privilege_matches = parliament.get_privilege_matches_for_resource_type(
resource_type_matches
)
# Check if we were given a privilege
if args.privilege is not None:
# Confirm these privileges exist
expanded_actions = parliament.expand_action(args.privilege)
if len(expanded_actions) == 0:
raise Exception("Unknown privilege {}".format(args.privilege))