On Tue, Jan 31, 2017 at 11:19 AM, Steven M Chegash <
steven.cheg...@dteenergy.com> wrote:

>
>
>
>
> mesg = 
> Net::LDAP=HASH(0x1a1c00d0)->modify("uid=testcust34,ou=CSOPortal,ou=External
> Users,ou=People,o=mycompany.com", changes => [ delete =>  'myCrmId' ] ,
> delete=>[ 'objectclass'=>'myPortaleProfile' ]  );
>
>
>
> error_text:The request referenced an attribute that does not exist
>
>
>
> error_code:16
>
> server_error:GLPRDB050E Attribute myPortaleProfile was not found in the
> schema definition.
>
>
>
> error:GLPRDB050E Attribute myPortaleProfile was not found in the schema
> definition.
>
>
>

I can't say for certain, as I don't work with Net::LDAP frequently, but the
syntax you used (delete => ['objectclass'=>'myPortaleProfile']), implied
that you had the wrong syntax (array versus hash), and the docs (man
Net::LDAP) agree. The "modify" method can be called with a "delete" key in
two ways:

1. delete => [ ATTR, ... ]
This deletes every listed attribute in the arrayref defined by the brackets.

2. delete => { ATTR => VALUE, ... }
This deletes individual values from an attribute. It can also delete the
whole attribute if the value is an empty arrayref. This is the syntax you
want to use. Just replace your square brackets with curly ones (which means
hashref).

Here's another way to rewrite that:

  my %attr_to_delete = ( objectclass => 'myPortaleProfile' );
  $ldap->modify("uid=... etc ...", delete => \%attr_to_delete);


AFAICT, you should either drop your use of "changes" with a separate
delete, or combine them all into changes. "changes" is there if "you want
to control the order in which the operations will be performed" (quoting
the docs).

To delete one attribute entirely, and delete a value from another one, I
think you would want to do:

  $ldap->modify("uid=...etc...", delete => {
    myCrmId => [],
    objectClass => 'myPortaleProfile',
  });


Hope that helps,
--
Josh I.

Reply via email to