From 9092a3a39bb299f34c4187b44b877b7bec1a08b6 Mon Sep 17 00:00:00 2001 From: Brian Lycett Date: Mon, 4 Apr 2022 13:55:56 +0100 Subject: [PATCH] Add attribute fields for groups and allow user-defined attributes to be displayed. Move alert banner JS to a function. --- www/account_manager/groups.php | 23 +- www/account_manager/index.php | 24 +- www/account_manager/new_user.php | 29 ++- www/account_manager/show_group.php | 379 ++++++++++++++++------------ www/account_manager/show_user.php | 113 +++------ www/includes/config.inc.php | 5 + www/includes/ldap_functions.inc.php | 210 ++++++++------- www/includes/web_functions.inc.php | 15 +- 8 files changed, 427 insertions(+), 371 deletions(-) diff --git a/www/account_manager/groups.php b/www/account_manager/groups.php index fbbe471..b6d865d 100644 --- a/www/account_manager/groups.php +++ b/www/account_manager/groups.php @@ -14,37 +14,18 @@ $ldap_connection = open_ldap_connection(); if (isset($_POST['delete_group'])) { - ?> - - - - $this_group was deleted."); } else { - ?> - - $this_group wasn't deleted. See the logs for more information.","danger",15000); } - } $groups = ldap_get_group_list($ldap_connection); diff --git a/www/account_manager/index.php b/www/account_manager/index.php index 573ebda..c6d5e28 100644 --- a/www/account_manager/index.php +++ b/www/account_manager/index.php @@ -14,39 +14,21 @@ $ldap_connection = open_ldap_connection(); if (isset($_POST['delete_user'])) { - ?> - - - - $this_user was deleted."); } else { - ?> - - $this_user wasn't deleted. See the logs for more information.","danger",15000); } } -#' + $people = ldap_get_user_list($ldap_connection); ?> diff --git a/www/account_manager/new_user.php b/www/account_manager/new_user.php index f7bacf1..7732654 100644 --- a/www/account_manager/new_user.php +++ b/www/account_manager/new_user.php @@ -6,7 +6,11 @@ include_once "web_functions.inc.php"; include_once "ldap_functions.inc.php"; include_once "module_functions.inc.php"; -$attribute_map = ldap_complete_account_attribute_array(); +$attribute_map = $LDAP['default_attribute_map']; +if (isset($LDAP['account_additional_attributes'])) { $attribute_map = ldap_complete_attribute_array($attribute_map,$LDAP['account_additional_attributes']); } +if (! array_key_exists($LDAP['account_attribute'], $attribute_map)) { + $attribute_r = array_merge($attribute_map, array($LDAP['account_attribute'] => array("label" => "Account UID"))); +} if ( isset($_POST['setup_admin_account']) ) { $admin_setup = TRUE; @@ -321,18 +325,17 @@ $tabindex=1; - - $attr_r) { - $label = $attr_r['label']; - if (isset($attr_r['onkeyup'])) { $onkeyup = $attr_r['onkeyup']; } else { $onkeyup = ""; } - if ($attribute == $LDAP['account_attribute']) { $label = "$label*"; } - if (isset($$attribute)) { $these_values=$$attribute; } else { $these_values = array(); } - if (isset($attr_r['multiple'])) { $multiple = $attr_r['multiple']; } else { $multiple = FALSE; } - render_attribute_fields($attribute,$label,$these_values,$onkeyup,$multiple,$tabindex); - $tabindex++; - } -?> + $attr_r) { + $label = $attr_r['label']; + if (isset($attr_r['onkeyup'])) { $onkeyup = $attr_r['onkeyup']; } else { $onkeyup = ""; } + if ($attribute == $LDAP['account_attribute']) { $label = "$label*"; } + if (isset($$attribute)) { $these_values=$$attribute; } else { $these_values = array(); } + if (isset($attr_r['multiple'])) { $multiple = $attr_r['multiple']; } else { $multiple = FALSE; } + render_attribute_fields($attribute,$label,$these_values,$onkeyup,$multiple,$tabindex); + $tabindex++; + } + ?>
diff --git a/www/account_manager/show_group.php b/www/account_manager/show_group.php index a212c34..18c783a 100644 --- a/www/account_manager/show_group.php +++ b/www/account_manager/show_group.php @@ -12,19 +12,18 @@ render_submenu(); $ldap_connection = open_ldap_connection(); - if (!isset($_POST['group_name']) and !isset($_GET['group_name'])) { ?>

The group name is missing.

The group name is invalid.

$attr_r) { + + if (isset($this_group[0][$attribute]) and $this_group[0][$attribute]['count'] > 0) { + $$attribute = $this_group[0][$attribute]; + } + else { + $$attribute = array(); + } + + if (isset($_POST[$attribute])) { + + $this_attribute = array(); + + if (is_array($_POST[$attribute])) { + $this_attribute['count'] = count($_POST[$attribute]); + foreach($_POST[$attribute] as $key => $value) { + $this_attribute[$key] = filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS); + } + } + else { + $this_attribute['count'] = 1; + $this_attribute[0] = filter_var($_POST[$attribute], FILTER_SANITIZE_FULL_SPECIAL_CHARS); + } + + if ($this_attribute != $$attribute) { + $$attribute = $this_attribute; + $to_update[$attribute] = $this_attribute; + unset($to_update[$attribute]['count']); + } + + } + + if (!isset($$attribute) and isset($attr_r['default'])) { + $$attribute['count'] = 1; + $$attribute[0] = $attr_r['default']; + } + +} + +if (!isset($gidnumber[0]) or !is_numeric($gidnumber[0])) { + $gidnumber[0]=ldap_get_highest_id($ldap_connection,$type="gid"); + $gidnumber['count']=1; +} ###################################################################################### - -$current_members = ldap_get_group_members($ldap_connection,$group_cn); -$full_dn = ldap_get_dn_of_group($ldap_connection,$group_cn); $all_accounts = ldap_get_user_list($ldap_connection); $all_people = array(); foreach ($all_accounts as $this_person => $attrs) { - array_push($all_people, $this_person); + array_push($all_people, $this_person); } $non_members = array_diff($all_people,$current_members); if (isset($_POST["update_members"])) { - $updated_membership = array(); + $updated_membership = array(); - foreach ($_POST as $index => $member) { - - if (is_numeric($index)) { - array_push($updated_membership,$member); + foreach ($_POST['membership'] as $index => $member) { + if (is_numeric($index)) { + array_push($updated_membership,filter_var($member, FILTER_SANITIZE_FULL_SPECIAL_CHARS)); + } } - } - if ($group_cn == $LDAP['admins_group'] and !array_search($USER_ID, $updated_membership)){ - array_push($updated_membership,$USER_ID); - } + if ($group_cn == $LDAP['admins_group'] and !array_search($USER_ID, $updated_membership)){ + array_push($updated_membership,$USER_ID); + } - $members_to_del = array_diff($current_members,$updated_membership); - $members_to_add = array_diff($updated_membership,$current_members); + $members_to_del = array_diff($current_members,$updated_membership); + $members_to_add = array_diff($updated_membership,$current_members); - if ($initialise_group == TRUE) { - $initial_member = array_shift($members_to_add); - $group_add = ldap_new_group($ldap_connection,$group_cn,$initial_member); - } - foreach ($members_to_add as $this_member) { - ldap_add_member_to_group($ldap_connection,$group_cn,$this_member); - } + if ($initialise_group == TRUE) { + $initial_member = array_shift($members_to_add); + $group_add = ldap_new_group($ldap_connection,$group_cn,$initial_member,$to_update); + } + elseif(count($to_update) > 0) { + $updated_attr = ldap_update_group_attributes($ldap_connection,$group_cn,$to_update); + if ($updated_attr) { + render_alert_banner("The group attributes have been updated."); + } + else { + render_alert_banner("There was a problem updating the group attributes. See the logs for more information.","danger",15000); + } + } - foreach ($members_to_del as $this_member) { - ldap_delete_member_from_group($ldap_connection,$group_cn,$this_member); - } + foreach ($members_to_add as $this_member) { + ldap_add_member_to_group($ldap_connection,$group_cn,$this_member); + } - $non_members = array_diff($all_people,$updated_membership); - $group_members = $updated_membership; + foreach ($members_to_del as $this_member) { + ldap_delete_member_from_group($ldap_connection,$group_cn,$this_member); + } - $rfc2307bis_available = ldap_detect_rfc2307bis($ldap_connection); - if ($rfc2307bis_available == TRUE and count($group_members) == 0) { + $non_members = array_diff($all_people,$updated_membership); + $group_members = $updated_membership; - $group_members = ldap_get_group_members($ldap_connection,$group_cn); - $non_members = array_diff($all_people,$group_members); + $rfc2307bis_available = ldap_detect_rfc2307bis($ldap_connection); + if ($rfc2307bis_available == TRUE and count($group_members) == 0) { - ?> - - - - - - - - 0) { + $("#submit_members").prop("disabled", false); + $("#submit_attributes").prop("disabled", false); + } }); $('.dual-list .selector').click(function () { var $checkBox = $(this); @@ -257,97 +289,132 @@ ldap_close($ldap_connection);
+
+
+
-
-
-

(admin group)" ; } ?>

- -
/groups.php" method="post">
-
-
    -
  • - -
    +
    +

    (admin group)" ; } ?>

    + +
    /groups.php" method="post">
    +
    -
    +
      +
    • + -
      - Members -
      +
      -
      -
      - - +
      + Members +
      +
      +
      +
      + + +
      +
      +
      +
      + +
      +
      +
      +
        + $member
      \n"; + } + else { + print "
    • $member
    • \n"; + } + } + ?> +
    +
    -
-
-
- +
+ + +
+ + + + +
+ +
+ Available accounts +
+
+
+
+ +
+
+
+
+ + +
+
+
+
    + $nonmember\n"; + } + ?> +
+
-
-
    - $member
\n"; - } - else { - print "
  • $member
  • \n"; - } - } - ?> - -
    - -
    - - - - - - - - -
    - -
    - Available accounts -
    -
    -
    -
    - -
    -
    -
    -
    - - -
    -
    -
    -
      - $nonmember\n"; - } - ?> -
    -
    -
    - -
    - - - - + + +if ($SIMPLE_INTERFACE == TRUE) { + unset($attribute_map['gidnumber']); +} + +if (count($attribute_map) > 0) { ?> +
    +
    +

    Group attributes

    +
    +
    +
    + $attr_r) { + $label = $attr_r['label']; + if (isset($$attribute)) { $these_values=$$attribute; } else { $these_values = array(); } + if (isset($attr_r['multiple'])) { $multiple = $attr_r['multiple']; } else { $multiple = FALSE; } + print "
    "; + render_attribute_fields($attribute,$label,$these_values,"",$multiple,$tabindex); + print "
    "; + $tabindex++; + } + ?> +
    +
    +
    + +
    +
    +
    +
    +
    +
    + + + + + + diff --git a/www/account_manager/show_user.php b/www/account_manager/show_user.php index 63cd96a..66ad7fc 100644 --- a/www/account_manager/show_user.php +++ b/www/account_manager/show_user.php @@ -24,7 +24,11 @@ if ($SIMPLE_INTERFACE == FALSE) { } $LDAP['default_attribute_map']["mail"] = array("label" => "Email", "onkeyup" => "check_if_we_should_enable_sending_email();"); -$attribute_map = ldap_complete_account_attribute_array(); +$attribute_map = $LDAP['default_attribute_map']; +if (isset($LDAP['account_additional_attributes'])) { $attribute_map = ldap_complete_attribute_array($attribute_map,$LDAP['account_additional_attributes']); } +if (! array_key_exists($LDAP['account_attribute'], $attribute_map)) { + $attribute_r = array_merge($attribute_map, array($LDAP['account_attribute'] => array("label" => "Account UID"))); +} if (!isset($_POST['account_identifier']) and !isset($_GET['account_identifier'])) { ?> @@ -164,30 +168,10 @@ if ($ldap_search) { } if ($updated_account) { - ?> - - - - - - - - - - + $attr_r) { + $label = $attr_r['label']; + if (isset($attr_r['onkeyup'])) { $onkeyup = $attr_r['onkeyup']; } else { $onkeyup = ""; } + if ($attribute == $LDAP['account_attribute']) { $label = "$label*"; } + if (isset($$attribute)) { $these_values=$$attribute; } else { $these_values = array(); } + if (isset($attr_r['multiple'])) { $multiple = $attr_r['multiple']; } else { $multiple = FALSE; } + render_attribute_fields($attribute,$label,$these_values,$onkeyup,$multiple); + } + ?> - $attr_r) { - $label = $attr_r['label']; - if (isset($attr_r['onkeyup'])) { $onkeyup = $attr_r['onkeyup']; } else { $onkeyup = ""; } - if ($attribute == $LDAP['account_attribute']) { $label = "$label*"; } - if (isset($$attribute)) { $these_values=$$attribute; } else { $these_values = array(); } - if (isset($attr_r['multiple'])) { $multiple = $attr_r['multiple']; } else { $multiple = FALSE; } - render_attribute_fields($attribute,$label,$these_values,$onkeyup,$multiple); - } -?> - -
    - -
    - -
    -
    - -
    -
    - -
    - -
    - -
    -
    - - -
    - +
    +
    - Email the updated credentials to the user? +
    +
    + +
    +
    + +
    + +
    + +
    +
    + + +
    + +
    + Email the updated credentials to the user? +
    -
    -

    -
    +
    +

    +
    diff --git a/www/includes/config.inc.php b/www/includes/config.inc.php index f30f661..da7d16a 100644 --- a/www/includes/config.inc.php +++ b/www/includes/config.inc.php @@ -12,6 +12,11 @@ "mail" => array("label" => "Email", "onkeyup" => "auto_email_update = false; check_email_validity(document.getElementById('mail').value);") ); + $LDAP['group_objectclasses'] = array( 'person', 'inetOrgPerson', 'posixAccount' ); + $LDAP['default_group_attribute_map'] = array( "gidnumber" => array("label" => "Group ID number") + ); + + #Mandatory $LDAP['uri'] = getenv('LDAP_URI'); diff --git a/www/includes/ldap_functions.inc.php b/www/includes/ldap_functions.inc.php index 53c4195..3b4da4e 100644 --- a/www/includes/ldap_functions.inc.php +++ b/www/includes/ldap_functions.inc.php @@ -438,19 +438,17 @@ function ldap_get_group_list($ldap_connection,$start=0,$entries=NULL,$sort="asc" ################################## -function ldap_get_dn_of_group($ldap_connection,$group_name) { +function ldap_get_group_entry($ldap_connection,$group_name) { global $log_prefix, $LDAP, $LDAP_DEBUG; if (isset($group_name)) { $ldap_search_query = "(${LDAP['group_attribute']}=" . ldap_escape($group_name, "", LDAP_ESCAPE_FILTER) . ")"; - $ldap_search = @ ldap_search($ldap_connection, "${LDAP['group_dn']}", $ldap_search_query , array("dn")); + $ldap_search = @ ldap_search($ldap_connection, "${LDAP['group_dn']}", $ldap_search_query); $result = @ ldap_get_entries($ldap_connection, $ldap_search); - if (isset($result[0]['dn'])) { - return $result[0]['dn']; - } + return $result; } @@ -567,7 +565,7 @@ function ldap_user_group_membership($ldap_connection,$username) { ################################## -function ldap_new_group($ldap_connection,$group_name,$initial_member="") { +function ldap_new_group($ldap_connection,$group_name,$initial_member="",$extra_attributes=array()) { global $log_prefix, $LDAP, $LDAP_DEBUG; @@ -575,61 +573,70 @@ function ldap_new_group($ldap_connection,$group_name,$initial_member="") { if (isset($group_name)) { - $new_group = ldap_escape($group_name, "", LDAP_ESCAPE_FILTER); - $initial_member = ldap_escape($initial_member, "", LDAP_ESCAPE_FILTER); + $new_group = ldap_escape($group_name, "", LDAP_ESCAPE_FILTER); + $initial_member = ldap_escape($initial_member, "", LDAP_ESCAPE_FILTER); + $update_gid_store=FALSE; - $ldap_search_query = "(${LDAP['group_attribute']}=$new_group,${LDAP['group_dn']})"; - $ldap_search = @ ldap_search($ldap_connection, "${LDAP['group_dn']}", $ldap_search_query); - $result = @ ldap_get_entries($ldap_connection, $ldap_search); + $ldap_search_query = "(${LDAP['group_attribute']}=$new_group,${LDAP['group_dn']})"; + $ldap_search = @ ldap_search($ldap_connection, "${LDAP['group_dn']}", $ldap_search_query); + $result = @ ldap_get_entries($ldap_connection, $ldap_search); - if ($result['count'] == 0) { + if ($result['count'] == 0) { - $highest_gid = ldap_get_highest_id($ldap_connection,'gid'); - $new_gid = $highest_gid + 1; + if ($rfc2307bis_available == FALSE) { $objectclasses = array('top','posixGroup'); } else { $objectclasses = array('top','groupOfUniqueNames','posixGroup'); } + if (isset($LDAP['group_additional_objectclasses']) and $LDAP['group_additional_objectclasses'] != "") { + $objectclasses = array_merge($objectclasses, explode(",", $LDAP['group_additional_objectclasses'])); + } + if ($LDAP['group_membership_uses_uid'] == FALSE and $initial_member != "") { $initial_member = "${LDAP['account_attribute']}=$initial_member,${LDAP['user_dn']}"; } - if ($rfc2307bis_available == FALSE) { $objectclasses = array('top','posixGroup'); } else { $objectclasses = array('top','groupOfUniqueNames','posixGroup'); } - if (isset($LDAP['group_additional_objectclasses']) and $LDAP['group_additional_objectclasses'] != "") - $objectclasses = array_merge($objectclasses, explode(",", $LDAP['group_additional_objectclasses'])); - if ($LDAP['group_membership_uses_uid'] == FALSE and $initial_member != "") { $initial_member = "${LDAP['account_attribute']}=$initial_member,${LDAP['user_dn']}"; } + $new_group_array=array( 'objectClass' => $objectclasses, + 'cn' => $new_group, + $LDAP['group_membership_attribute'] => $initial_member + ); - $new_group_array=array( 'objectClass' => $objectclasses, - 'cn' => $new_group, - 'gidNumber' => $new_gid, - $LDAP['group_membership_attribute'] => $initial_member - ); + $new_group_array = array_merge($new_group_array,$extra_attributes); - $group_dn="cn=$new_group,${LDAP['group_dn']}"; + if (!isset($new_group_array["gidnumber"][0]) or !is_numeric($new_group_array["gidnumber"][0])) { + $highest_gid = ldap_get_highest_id($ldap_connection,'gid'); + $new_gid = $highest_gid + 1; + $new_group_array["gidnumber"] = $new_gid; + $update_gid_store=TRUE; + } - $add_group = @ ldap_add($ldap_connection, $group_dn, $new_group_array); + $group_dn="cn=$new_group,${LDAP['group_dn']}"; - if (! $add_group ) { - $this_error="$log_prefix LDAP: unable to add new group (${group_dn}): " . ldap_error($ldap_connection); - if ($LDAP_DEBUG == TRUE) { error_log("$log_prefix DEBUG add_group array: ". print_r($new_group_array,true),0); } - error_log($this_error,0); - } - else { - error_log("$log_prefix Added new group $group_name",0); + $add_group = @ ldap_add($ldap_connection, $group_dn, $new_group_array); - $this_gid = fetch_id_stored_in_ldap($ldap_connection,"gid"); - if ($this_gid != FALSE) { - $update_gid = @ ldap_mod_replace($ldap_connection, "cn=lastGID,${LDAP['base_dn']}", array( 'serialNumber' => $new_gid )); - if ($update_gid) { - error_log("$log_prefix Updated cn=lastGID with $new_gid",0); + if (! $add_group ) { + $this_error="$log_prefix LDAP: unable to add new group (${group_dn}): " . ldap_error($ldap_connection); + if ($LDAP_DEBUG == TRUE) { error_log("$log_prefix DEBUG add_group array: ". print_r($new_group_array,true),0); } + error_log($this_error,0); } else { - error_log("$log_prefix Unable to update cn=lastGID to $new_gid - this could cause groups to share the same GID.",0); - } - } - return TRUE; - } + error_log("$log_prefix Added new group $group_name",0); - } - else { - error_log("$log_prefix Create group; group $group_name already exists.",0); - } + if ($update_gid_store == TRUE) { + $this_gid = fetch_id_stored_in_ldap($ldap_connection,"gid"); + if ($this_gid != FALSE) { + $update_gid = @ ldap_mod_replace($ldap_connection, "cn=lastGID,${LDAP['base_dn']}", array( 'serialNumber' => $new_gid )); + if ($update_gid) { + error_log("$log_prefix Updated cn=lastGID with $new_gid",0); + } + else { + error_log("$log_prefix Unable to update cn=lastGID to $new_gid - this could cause groups to share the same GID.",0); + } + } + return TRUE; + } + } + + } + else { + error_log("$log_prefix Create group; group $group_name already exists.",0); + } } else { - error_log("$log_prefix Create group; group name wasn't set.",0); + error_log("$log_prefix Create group; group name wasn't set.",0); } return FALSE; @@ -637,6 +644,37 @@ function ldap_new_group($ldap_connection,$group_name,$initial_member="") { } +################################## + +function ldap_update_group_attributes($ldap_connection,$group_name,$extra_attributes) { + + global $log_prefix, $LDAP, $LDAP_DEBUG; + + if (isset($group_name) and (count($extra_attributes) > 0)) { + + $group_name = ldap_escape($group_name, "", LDAP_ESCAPE_FILTER); + $group_dn = "${LDAP['group_attribute']}=$group_name,${LDAP['group_dn']}"; + + $update_group = @ ldap_mod_replace($ldap_connection, $group_dn, $extra_attributes); + + if (!$update_group ) { + $this_error="$log_prefix LDAP: unable to update group attributes for group (${group_dn}): " . ldap_error($ldap_connection); + if ($LDAP_DEBUG == TRUE) { error_log("$log_prefix DEBUG update group attributes array: ". print_r($extra_attributes,true),0); } + error_log($this_error,0); + return FALSE; + } + else { + error_log("$log_prefix Updated group attributes for $group_name",0); + return TRUE; + } + } + else { + error_log("$log_prefix Update group attributes; group name wasn't set.",0); + return FALSE; + } + +} + ################################## function ldap_delete_group($ldap_connection,$group_name) { @@ -687,58 +725,54 @@ function ldap_get_gid_of_group($ldap_connection,$group_name) { ################################## -function ldap_complete_account_attribute_array() { +function ldap_complete_attribute_array($default_attributes,$additional_attributes) { - global $LDAP; + global $LDAP; - $attribute_r = $LDAP['default_attribute_map']; - $additional_attributes_r = array(); + if (is_array($additional_attributes) and count($additional_attributes > 0)) { - if (isset($LDAP['account_additional_attributes'])) { + $user_attribute_r = explode(",", $additional_attributes); + $to_merge = array(); - $user_attribute_r = explode(",", $LDAP['account_additional_attributes']); + foreach ($user_attribute_r as $this_attr) { - foreach ($user_attribute_r as $this_attr) { + $this_r = array(); + $kv = explode(":", $this_attr); + $attr_name = strtolower(filter_var($kv[0], FILTER_SANITIZE_FULL_SPECIAL_CHARS)); + if (substr($attr_name, -1) == '+') { + $this_r['multiple'] = TRUE; + $attr_name = rtrim($attr_name, '+'); + } + else { + $this_r['multiple'] = FALSE; + } - $this_r = array(); - $kv = explode(":", $this_attr); - $attr_name = strtolower(filter_var($kv[0], FILTER_SANITIZE_FULL_SPECIAL_CHARS)); - if (substr($attr_name, -1) == '+') { - $this_r['multiple'] = TRUE; - $attr_name = rtrim($attr_name, '+'); - } - else { - $this_r['multiple'] = FALSE; + if (preg_match('/^[a-zA-Z0-9\-]+$/', $attr_name) == 1) { + + if (isset($kv[1]) and $kv[1] != "") { + $this_r['label'] = filter_var($kv[1], FILTER_SANITIZE_FULL_SPECIAL_CHARS); + } + else { + $this_r['label'] = $attr_name; + } + + if (isset($kv[2]) and $kv[2] != "") { + $this_r['default'] = filter_var($kv[2], FILTER_SANITIZE_FULL_SPECIAL_CHARS); + } + + $to_merge[$attr_name] = $this_r; + + } } + $attribute_r = array_merge($default_attributes, $to_merge); - if (preg_match('/^[a-zA-Z0-9\-]+$/', $attr_name) == 1) { + return($attribute_r); - if (isset($kv[1]) and $kv[1] != "") { - $this_r['label'] = filter_var($kv[1], FILTER_SANITIZE_FULL_SPECIAL_CHARS); - } - else { - $this_r['label'] = $attr_name; - } - - if (isset($kv[2]) and $kv[2] != "") { - $this_r['default'] = filter_var($kv[2], FILTER_SANITIZE_FULL_SPECIAL_CHARS); - } - - $additional_attributes_r[$attr_name] = $this_r; - - } } - - $attribute_r = array_merge($attribute_r, $additional_attributes_r); - - } - - if (! array_key_exists($LDAP['account_attribute'], $attribute_r)) { - $attribute_r = array_merge($attribute_r, array($LDAP['account_attribute'] => array("label" => "Account UID"))); - } - - return($attribute_r); + else { + return($default_attributes); + } } diff --git a/www/includes/web_functions.inc.php b/www/includes/web_functions.inc.php index 179b65e..5af6772 100644 --- a/www/includes/web_functions.inc.php +++ b/www/includes/web_functions.inc.php @@ -654,6 +654,19 @@ function render_attribute_fields($attribute,$label,$values_r,$onkeyup="",$multip } +###################################################### + +function render_alert_banner($message,$alert_class="success",$timeout=4000) { -##EoFilelocal +?> + + +