From: Brian O'N. <on...@oi...> - 2001-01-17 20:55:46
|
I'm dealing with a lot of multivalued attributes. Is there a way to delete/add values to a multi-valued attribute without doing all of them? Also, when modifying a number of attributes, the write_cmd() method of Net::LDAP::LDIF seems to only modify one attribute at a time - is this correct? -- ====================================================================== Brian O'Neill @ home on...@oi... At work I'm: on...@co... |
From: Mark W. <mew...@un...> - 2001-01-17 21:19:17
|
if you delete with a specific value then it will delete that particular value. If you do a replace and only give a single value, it will replace all of the values with that value. An add simply adds the value to the existing values. Mark Brian O'Neill wrote: > I'm dealing with a lot of multivalued attributes. > > Is there a way to delete/add values to a multi-valued attribute without > doing all of them? > > Also, when modifying a number of attributes, the write_cmd() method of > Net::LDAP::LDIF seems to only modify one attribute at a time - is this > correct? > > -- > ====================================================================== > Brian O'Neill @ home on...@oi... > At work I'm: on...@co... |
From: Brian O'N. <on...@oi...> - 2001-01-18 18:59:35
|
On Wed, 17 Jan 2001, Mark Wilcox wrote: > if you delete with a specific value then it will delete that particular > value. If you do a replace and only give a single value, it will replace > all of the values with that value. > This does not appear to be true. The delete() method does not appear to accept a value, only an attribute (or attributes). Attempting to specify one results in an execution error: Can't use string ("directcustomer") as an ARRAY ref while "strict refs" in use at /usr/local/lib/perl5/site_perl/5.005/Net/LDAP/Entry.pm line 179. Using replace() does indeed replace all values, but I want to add/delete specific values. > An add simply adds the value to the existing values. This appears to have zero effect, at least as far as the output from write_cmd() is concerned. -- ====================================================================== Brian O'Neill @ home on...@oi... At work I'm: on...@co... |
From: Mark W. <mew...@un...> - 2001-01-18 21:32:19
|
Delete occurs as a modify: Like this: $ldap->modify( $dn, delete => { 'telephoneNumber' => '911' }); would delete the telephonenumber of 911 but it would leave the rest alone. As for adds lets say you have an attribute of cn. It has values of Mark Wilcox and Mark E. Wilcox . You want to add Mark Edward Wilcox. This is how you would do it: $ldap->modify( $dn, add => { 'cn' => 'Mark Edward Wilcox' }); Now if those are not working (I imagine we'd have heard by now). Do the following: 1) make sure you're not using Perl 5.6. There are bugs in 5.6 that cause Net::LDAP problems. 2) send the output of $ldap->debug(3) to the list. Mark Brian O'Neill wrote: > On Wed, 17 Jan 2001, Mark Wilcox wrote: > > > if you delete with a specific value then it will delete that particular > > value. If you do a replace and only give a single value, it will replace > > all of the values with that value. > > > > This does not appear to be true. > > The delete() method does not appear to accept a value, only an attribute > (or attributes). Attempting to specify one results in an execution error: > > Can't use string ("directcustomer") as an ARRAY ref while "strict refs" in > use at /usr/local/lib/perl5/site_perl/5.005/Net/LDAP/Entry.pm line 179. > > Using replace() does indeed replace all values, but I want to add/delete > specific values. > > > An add simply adds the value to the existing values. > > This appears to have zero effect, at least as far as the output from > write_cmd() is concerned. > > -- > ====================================================================== > Brian O'Neill @ home on...@oi... > At work I'm: on...@co... |
From: Chris B. <bri...@po...> - 2001-01-18 21:34:03
|
On 2001-01-18, "Brian O'Neill" <on...@oi...> wrote: > On Wed, 17 Jan 2001, Mark Wilcox wrote: > > > if you delete with a specific value then it will delete that > > particular value. If you do a replace and only give a single > > value, it will replace all of the values with that value. > > The delete() method does not appear to accept a value, only an > attribute (or attributes). Attempting to specify one results in > an execution error: You have to give it an array reference to delete a particular value. If I remember correctly this is undocumented, I had to look at the source to find out you could do this: ,----[ Delete a specific attribute ] | $ldap_entry->delete($attr => [$value]) `---- |
From: Brian O'N. <on...@oi...> - 2001-01-19 15:33:29
|
Thanks...this is exactly what was needed... -Brian On 18 Jan 2001, Chris Brierley wrote: > On 2001-01-18, "Brian O'Neill" <on...@oi...> wrote: > > On Wed, 17 Jan 2001, Mark Wilcox wrote: > > > > > if you delete with a specific value then it will delete that > > > particular value. If you do a replace and only give a single > > > value, it will replace all of the values with that value. > > > > The delete() method does not appear to accept a value, only an > > attribute (or attributes). Attempting to specify one results in > > an execution error: > > You have to give it an array reference to delete a particular > value. If I remember correctly this is undocumented, I had to > look at the source to find out you could do this: > > ,----[ Delete a specific attribute ] > | $ldap_entry->delete($attr => [$value]) > `---- > > -- ====================================================================== Brian O'Neill @ home on...@oi... At work I'm: on...@co... |
From: Brian O'N. <on...@oi...> - 2001-01-18 20:57:26
|
OK, to answer at least part of my own questions: On the write_cmd() issue, it was actually a bit bigger. Because there were no "advertised" methods to determine if an entry had already bee modified "changetype" returns "modify" on an unmodified entry), I set changetype('modify') each time - lo and behold, that wipes out all previous changes. Seems I could get away with NOT setting changetype at all, but that wasn't clear from the documentation. Once I stopped setting it (or set it BEFORE changing the attributes), everything worked as expected. -Brian On Wed, 17 Jan 2001, Brian O'Neill wrote: > I'm dealing with a lot of multivalued attributes. > > Is there a way to delete/add values to a multi-valued attribute without > doing all of them? > > Also, when modifying a number of attributes, the write_cmd() method of > Net::LDAP::LDIF seems to only modify one attribute at a time - is this > correct? > -- ====================================================================== Brian O'Neill @ home on...@oi... At work I'm: on...@co... |