labeledURI => 1,
mail => 1,
mobile => 1,
- o => 1
+ o => 1,
+ userPassword => 0
);
our %ExternalNames =
uri => 'labeledURI',
mail => 'mail',
cellphone => 'mobile',
- group => 'o'
+ group => 'o',
+ password => 'userPassword'
);
our $Ldap;
if (@disjunc)
{
- push (@konjunct, join ('', '(|', @disjunc, ')'));
+ my $tmp;
+ if (scalar (@disjunc) == 1)
+ {
+ $tmp = $disjunc[0];
+ }
+ else
+ {
+ $tmp = join ('', '(|', @disjunc, ')');
+ }
+ push (@konjunct, $tmp);
}
}
=item I<$obj>-E<gt>B<group> ([I<@groups>])
-Get or set the attribute.
+Get or set the attribute. This is the same as calling S<I<$obj>-E<gt>B<set>
+(I<$field>, I<\@values>)> or S<I<$obj>-E<gt>B<get> (I<$field>)>.
=cut
return (set ($obj, $field, @values ? [@values] : undef))
}
+=item I<$obj>-E<gt>B<get> (I<$field>)
+
+Returs the value(s) of field I<$field>.
+
+=cut
+
sub get
{
my $obj = shift;
my $field = shift;
- return (set ($obj, $field, undef));
+ if (wantarray ())
+ {
+ return (set ($obj, $field, undef));
+ }
+ else
+ {
+ return (scalar (set ($obj, $field, undef)));
+ }
}
+=item I<$obj>-E<gt>B<set> (I<$field>, I<\@values>)
+
+Sets the field I<$field> to the value(s) I<\@valued>. Pass an empty array-ref
+to delete the field.
+
+=cut
+
sub set
{
my $obj = shift;
return ($cn, $id);
}
-sub password
-{
- my $obj = shift;
- my $entry = $obj->{'ldap'};
- my $pwd;
-
- if (@_)
- {
- $pwd = shift;
- $entry->changetype ('modify');
- $entry->replace (userPassword => $pwd);
- $entry->update ($Ldap);
- }
-
- $pwd = $entry->get_value ('userPassword');
-}
-
=back
=head1 AUTHOR