Allow editing of LDAP group description

This commit is contained in:
Jamie Cameron
2010-01-28 15:39:43 -08:00
parent 17c095c492
commit cc190cb36a
4 changed files with 20 additions and 0 deletions

View 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.

View File

@ -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,

View 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

View File

@ -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,