You are here

function _services_ipauth_security_settings in Services IP Authentication 7

Same name and namespace in other branches
  1. 6 services_ipauth.inc \_services_ipauth_security_settings()

Security settings form.

See also

services_ipauth_services_authentication_info()

1 string reference to '_services_ipauth_security_settings'
services_ipauth_services_authentication_info in ./services_ipauth.module
Implementation of hook_services_authentication().

File

./services_ipauth.inc, line 52
Provides callbacks for the IP Authentication module.

Code

function _services_ipauth_security_settings($settings) {
  $form = array();
  if (!is_array($settings)) {
    $settings = array();
  }
  $form['services_ipauth_type'] = array(
    '#title' => t('Type of IP filtering'),
    '#type' => 'radios',
    '#options' => array(
      SERVICES_IPAUTH_TYPE_DENY => t('Deny'),
      SERVICES_IPAUTH_TYPE_ALLOW => t('Allow'),
    ),
    '#description' => t('Choose the method of IP address filtering. "Allow" means you need to list only addresses that can have access. All others will be denied. "Deny" means access will be granted to every address except listed below'),
    '#default_value' => isset($settings['services_ipauth_type']) ? $settings['services_ipauth_type'] : SERVICES_IPAUTH_TYPE_DENY,
  );
  $form['services_ipauth_addresses'] = array(
    '#title' => t('IP addresses'),
    '#type' => 'textarea',
    '#description' => t('One IP address per line.'),
    '#default_value' => isset($settings['services_ipauth_addresses']) ? implode("\n", $settings['services_ipauth_addresses']) : '',
    '#element_validate' => array(
      '_services_ipauth_ips_validate',
    ),
  );
  return $form;
}