You are here

function saml_sp_idp_save in SAML Service Provider 7

Same name and namespace in other branches
  1. 7.8 saml_sp.module \saml_sp_idp_save()
  2. 7.2 saml_sp.module \saml_sp_idp_save()
  3. 7.3 saml_sp.module \saml_sp_idp_save()

Save an IDP configuration.

Parameters

Object $idp: A populated IDP object, with the keys:

  • name
  • machine_name
  • app_name
  • login_url
  • x509_cert

Return value

Int One of:

1 call to saml_sp_idp_save()
saml_sp__configure_idp_form_submit in ./saml_sp.admin.inc
Submit handler for the SAML IDP configuration form.

File

./saml_sp.module, line 170
SAML Service Provider

Code

function saml_sp_idp_save($idp) {

  // Prevent PHP notices by ensure 'export_type' is populated.
  if (empty($idp->export_type)) {
    $idp->export_type = NULL;
  }

  // Handle changes of machine name (if which case $idp->orig_machine_name
  // should be populated).
  if (!empty($idp->orig_machine_name)) {
    saml_sp_idp_delete($idp->orig_machine_name);
    $idp->export_type = NULL;
  }

  // Delegate to the CTools CRUD handler.
  $result = ctools_export_crud_save('saml_sp_idps', $idp);
  return isset($idp->orig_machine_name) && $result == SAVED_NEW ? SAVED_UPDATED : $result;
}