<commit_before>
def whyrun_supported?
  true
end

def get_admin_api_token
  password = if Chef::Config[:solo]
    node['boxbilling']['config']['db_password']
  else
    require 'chef-encrypted-attributes'
    Chef::EncryptedAttribute.load(node['boxbilling']['config']['db_password'])
  end
  db = BoxBilling::Database.new({
    :database => node['boxbilling']['config']['db_name'],
    :user     => node['boxbilling']['config']['db_user'],
    :password => password,
  })
  db.get_admin_api_token || begin
    db.generate_admin_api_token
    db.get_admin_api_token
  end
end

# Remove unnecessary slashes
def filter_path(path)
  path.gsub(/(^\/*|\/*$)/, '').gsub(/\/+/, '/')
end

# Get the final action string name for a path (from symbol)
# Examples:
#   (admin/client,   :create) -> create
#   (admin/currency, :create) -> create
#   (admin/product,  :create) -> prepare
def get_action_for_path(path, action)
  case action
  when :create
    case path
    when 'admin/product', 'admin/invoice'
      :prepare
    else
      action
    end
  when :update
    case path
    when 'admin/extension/config'
      :save
    when 'admin/staff/password'
      :change
    else
      action
    end
  else
    action
  end.to_s<commit_msg>Revert "boxbilling_api: added admin/staff/password update action"<commit_after>
def whyrun_supported?
  true
end

def get_admin_api_token
  password = if Chef::Config[:solo]
    node['boxbilling']['config']['db_password']
  else
    require 'chef-encrypted-attributes'
    Chef::EncryptedAttribute.load(node['boxbilling']['config']['db_password'])
  end
  db = BoxBilling::Database.new({
    :database => node['boxbilling']['config']['db_name'],
    :user     => node['boxbilling']['config']['db_user'],
    :password => password,
  })
  db.get_admin_api_token || begin
    db.generate_admin_api_token
    db.get_admin_api_token
  end
end

# Remove unnecessary slashes
def filter_path(path)
  path.gsub(/(^\/*|\/*$)/, '').gsub(/\/+/, '/')
end

# Get the final action string name for a path (from symbol)
# Examples:
#   (admin/client,   :create) -> create
#   (admin/currency, :create) -> create
#   (admin/product,  :create) -> prepare
def get_action_for_path(path, action)
  case action
  when :create
    case path
    when 'admin/product', 'admin/invoice'
      :prepare
    else
      action
    end
  when :update
    case path
    when 'admin/extension/config'
      :save
    else
      action
    end
  else
    action
  end.to_s
{'fraction_non_alphanumeric': 0.14493927125506073, 'fraction_numerical': 0.0, 'mean_word_length': 3.3734513274336284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3169042', 'n_tokens_mistral': 829, 'n_tokens_neox': 824, 'n_words': 183}