Пример #1
0
 def add_exclude_actions(self, exclude_actions):
     """To exclude actions from the output"""
     if exclude_actions:
         expanded_actions = determine_actions_to_expand(exclude_actions)
         self.exclude_actions = [x.lower() for x in expanded_actions]
     else:
         self.exclude_actions = []
Пример #2
0
def analyze_statement_by_access_level(statement_json, access_level):
    """
    Determine if a statement has any actions with a given access level.

    :param statement_json: a dictionary representing a statement from an AWS JSON policy
    :param access_level: The access level - either 'Read', 'List', 'Write', 'Tagging', or 'Permissions management'
    """
    requested_actions = get_actions_from_statement(statement_json)
    expanded_actions = determine_actions_to_expand(requested_actions)
    actions_by_level = remove_actions_not_matching_access_level(
        expanded_actions, access_level
    )
    return actions_by_level