Allow editing of LDAP group description
authorJamie Cameron <jcameron@webmin.com>
Thu, 28 Jan 2010 23:39:43 +0000 (15:39 -0800)
committerJamie Cameron <jcameron@webmin.com>
Thu, 28 Jan 2010 23:39:43 +0000 (15:39 -0800)
ldap-useradmin/CHANGELOG
ldap-useradmin/edit_group.cgi
ldap-useradmin/lang/en
ldap-useradmin/save_group.cgi

index 6c1ff03..2a42c62 100644 (file)
@@ -69,3 +69,5 @@ Added a Module Config option to use a text box for entering secondary group memb
 ---- Changes since 1.490 ----
 Improve the user and group rename code to not move the DN to be under the global base if not needed.
 Modifying a user now correctly changes the sn attribute too.
+---- Changes since 1.500 ----
+Added a field for editing the description for LDAP groups.
index a697231..7d0089b 100755 (executable)
@@ -17,6 +17,7 @@ else {
        $group = $ginfo->get_value('cn');
        $gid = $ginfo->get_value('gidNumber');
        $pass = $ginfo->get_value('userPassword');
+       $desc = $ginfo->get_value('description');
        @members = $ginfo->get_value('memberUid');
        foreach $oc ($ginfo->get_value('objectClass')) {
                $oclass{$oc} = 1;
@@ -66,6 +67,10 @@ else {
 print &ui_table_row($text{'gedit_gid'},
        $gidfield);
 
+# Description
+print &ui_table_row($text{'gedit_desc'},
+       &ui_textbox("desc", $desc, 40));
+
 # Group password (rarely used, but..)
 print &ui_table_row($text{'pass'},
        &ui_radio_table("passmode", $pass eq "" ? 0 : 1,
index 2d19daf..49a77a5 100644 (file)
@@ -71,6 +71,7 @@ gedit_dn=Group's LDAP DN
 gedit_return=group details
 gedit_cap=Group capabilities
 gedit_samba=Samba group?
+gedit_desc=Description
 
 gsave_egone=Group no longer exists!
 gsave_edelete=Failed to delete group from LDAP database : $1
index 9731421..5da682f 100755 (executable)
@@ -120,6 +120,7 @@ else {
        }
 $in{'gid'} =~ /^[0-9]+$/ || &error(&text('gsave_egid', $in{'gid'}));
 $gid = $in{'gid'};
+$desc = $in{'desc'} || undef;
 @members = split(/\r?\n/, $in{members});
 if ($in{'new'} || $oldgroup ne $group) {
        # Check for collision
@@ -232,6 +233,14 @@ if (!$in{'new'}) {
                $newdn = $in{'dn'};
                }
 
+       # Add or remove description
+       if ($desc) {
+               push(@props, "description" => $desc);
+               }
+       else {
+               push(@rprops, "description");
+               }
+
        # Update group properties
        $rv = $ldap->modify($newdn, replace =>
                            { "gidNumber" => $gid,
@@ -285,6 +294,9 @@ else {
                        if (&in_schema($schema, "sambaGrouptype") &&
                            $samba_group_schema == 3);
                }
+       if ($desc) {
+               push(@props, "description" => $desc);
+               }
        $rv = $ldap->add($newdn, attr =>
                         [ "cn" => $group,
                           "gidNumber" => $gid,