def export
CSV.open(option_csv_file || '/dev/stdout', 'wb', {:force_quotes => false}) do |csv|
csv << [NAME, COUNT, RESOURCE, SEARCH, PERMISSIONS, ORGANIZATIONS, LOCATIONS]
@api.resource(:roles).call(:index, {'per_page' => 999999})['results'].each do |role|
@api.resource(:filters).call(:index, {
'per_page' => 999999,
'search' => "role=\"#{role['name']}\""
})['results'].each do |filter|
filter = @api.resource(:filters).call(:show, 'id' => filter['id'])
permissions = export_column(filter, 'permissions', 'name')
organizations = export_column(filter, 'organizations', 'name')
locations = export_column(filter, 'locations', 'name')
csv << [role['name'], 1, filter['resource_type'], filter['search'] || '', permissions, organizations, locations]
end
end
end
HammerCLI::EX_OK
end