How to replace multiple values of an attribute

Hi,

I spent my whole afternoon searching for a solution for replacing all 
values of an attrbute by an array.

So what i got is basicly an reference $values to an array of my new 
values. I could iterate through the array using
foreach my $value (@$values) {...}

The code that works is:
my $mesg1=$backendConn->modify($dn,
                                        replace => [$attr, ["Hello", 
"Test"]]
                                         );

But i need to be more flexible and tried today a lot of variations of...
my $mesg1=$backendConn->modify($dn,
                                        replace => [$attr, @{$values}]
                                         );

This gave me the error...
Attribute <one of the values in my array> was not found in the schema 
definition.
inside the LDAP Server

$attr is a string that contains the name of the attribut.

Could somebody help me?
Oliver
0
oliver
4/13/2009 7:41:00 PM
perl.ldap 1268 articles. 0 followers. Follow

4 Replies
509 Views

Similar Articles

[PageSpeed] 8

Oliver,

I think the following should work (pass a reference to an array, not an arr=
ay):

my $mesg1=3D$backendConn->modify($dn,
                               replace =3D> { $attr, $values }
                              );
=20
Regards,
Ross

-----Original Message-----
From: Oliver D=F6rr [mailto:oliver@doerr-privat.de]=20
Sent: Monday, April 13, 2009 2:41 PM
To: perl-ldap@perl.org
Subject: How to replace multiple values of an attribute

Hi,

I spent my whole afternoon searching for a solution for replacing all value=
s of an attrbute by an array.

So what i got is basicly an reference $values to an array of my new values.=
 I could iterate through the array using foreach my $value (@$values) {...}

The code that works is:
my $mesg1=3D$backendConn->modify($dn,
                                        replace =3D> [$attr, ["Hello", "Tes=
t"]]
                                         );

But i need to be more flexible and tried today a lot of variations of...
my $mesg1=3D$backendConn->modify($dn,
                                        replace =3D> [$attr, @{$values}]
                                         );

This gave me the error...
Attribute <one of the values in my array> was not found in the schema defin=
ition.
inside the LDAP Server

$attr is a string that contains the name of the attribut.

Could somebody help me?
Oliver

0
rsteiner
4/13/2009 8:21:45 PM
Hmmm,

that does also not work.  $mesg1->error shows "Protocol error " and 
$mesg1->code = 2

No hint, in LDAP server log

Another idea?
Oliver


Steiner, Ross schrieb:
> Oliver,
>
> I think the following should work (pass a reference to an array, not an array):
>
> my $mesg1=$backendConn->modify($dn,
>                                replace => { $attr, $values }
>                               );
>  
> Regards,
> Ross
>
> -----Original Message-----
> From: Oliver D�rr [mailto:oliver@doerr-privat.de] 
> Sent: Monday, April 13, 2009 2:41 PM
> To: perl-ldap@perl.org
> Subject: How to replace multiple values of an attribute
>
> Hi,
>
> I spent my whole afternoon searching for a solution for replacing all values of an attrbute by an array.
>
> So what i got is basicly an reference $values to an array of my new values. I could iterate through the array using foreach my $value (@$values) {...}
>
> The code that works is:
> my $mesg1=$backendConn->modify($dn,
>                                         replace => [$attr, ["Hello", "Test"]]
>                                          );
>
> But i need to be more flexible and tried today a lot of variations of...
> my $mesg1=$backendConn->modify($dn,
>                                         replace => [$attr, @{$values}]
>                                          );
>
> This gave me the error...
> Attribute <one of the values in my array> was not found in the schema definition.
> inside the LDAP Server
>
> $attr is a string that contains the name of the attribut.
>
> Could somebody help me?
> Oliver
>
>
>   
0
oliver
4/13/2009 8:50:25 PM
On Apr 13, 2009, at 3:50 PM, Oliver D=F6rr wrote:

> Hmmm,
>
> that does also not work.  $mesg1->error shows "Protocol error " and =20=

> $mesg1->code =3D 2
>
> No hint, in LDAP server log

Hm, it should have worked. can you turn on debug with $backendConn-=20
 >debug(15); just before you call ->modify so we can see what it being =20=

sent to the server

Graham.

>
>
> Another idea?
> Oliver
>
>
> Steiner, Ross schrieb:
>> Oliver,
>>
>> I think the following should work (pass a reference to an array, =20
>> not an array):
>>
>> my $mesg1=3D$backendConn->modify($dn,
>>                               replace =3D> { $attr, $values }
>>                              );
>> Regards,
>> Ross
>>
>> -----Original Message-----
>> From: Oliver D=F6rr [mailto:oliver@doerr-privat.de] Sent: Monday, =20
>> April 13, 2009 2:41 PM
>> To: perl-ldap@perl.org
>> Subject: How to replace multiple values of an attribute
>>
>> Hi,
>>
>> I spent my whole afternoon searching for a solution for replacing =20
>> all values of an attrbute by an array.
>>
>> So what i got is basicly an reference $values to an array of my new =20=

>> values. I could iterate through the array using foreach my $value (@=20=

>> $values) {...}
>>
>> The code that works is:
>> my $mesg1=3D$backendConn->modify($dn,
>>                                        replace =3D> [$attr, ["Hello", =
=20
>> "Test"]]
>>                                         );
>>
>> But i need to be more flexible and tried today a lot of variations =20=

>> of...
>> my $mesg1=3D$backendConn->modify($dn,
>>                                        replace =3D> [$attr, =
@{$values}]
>>                                         );
>>
>> This gave me the error...
>> Attribute <one of the values in my array> was not found in the =20
>> schema definition.
>> inside the LDAP Server
>>
>> $attr is a string that contains the name of the attribut.
>>
>> Could somebody help me?
>> Oliver
>>
>>
>>
>

0
gbarr
4/13/2009 9:19:29 PM
Hi Graham,

thanks for your hint. I found it. The correct syntax was

my $mesg1=$backendConn->modify($dn, replace => [$attr, $values]);

The problem was, that $values was iso-8859-1 encoded. After decoding it, 
it works.

Thanks again

Oliver

Graham Barr schrieb:
>
> On Apr 13, 2009, at 3:50 PM, Oliver D�rr wrote:
>
>> Hmmm,
>>
>> that does also not work.  $mesg1->error shows "Protocol error " and 
>> $mesg1->code = 2
>>
>> No hint, in LDAP server log
>
> Hm, it should have worked. can you turn on debug with 
> $backendConn->debug(15); just before you call ->modify so we can see 
> what it being sent to the server
>
> Graham.
>
>>
>>
>> Another idea?
>> Oliver
>>
>>
>> Steiner, Ross schrieb:
>>> Oliver,
>>>
>>> I think the following should work (pass a reference to an array, not 
>>> an array):
>>>
>>> my $mesg1=$backendConn->modify($dn,
>>>                               replace => { $attr, $values }
>>>                              );
>>> Regards,
>>> Ross
>>>
>>> -----Original Message-----
>>> From: Oliver D�rr [mailto:oliver@doerr-privat.de] Sent: Monday, 
>>> April 13, 2009 2:41 PM
>>> To: perl-ldap@perl.org
>>> Subject: How to replace multiple values of an attribute
>>>
>>> Hi,
>>>
>>> I spent my whole afternoon searching for a solution for replacing 
>>> all values of an attrbute by an array.
>>>
>>> So what i got is basicly an reference $values to an array of my new 
>>> values. I could iterate through the array using foreach my $value 
>>> (@$values) {...}
>>>
>>> The code that works is:
>>> my $mesg1=$backendConn->modify($dn,
>>>                                        replace => [$attr, ["Hello", 
>>> "Test"]]
>>>                                         );
>>>
>>> But i need to be more flexible and tried today a lot of variations 
>>> of...
>>> my $mesg1=$backendConn->modify($dn,
>>>                                        replace => [$attr, @{$values}]
>>>                                         );
>>>
>>> This gave me the error...
>>> Attribute <one of the values in my array> was not found in the 
>>> schema definition.
>>> inside the LDAP Server
>>>
>>> $attr is a string that contains the name of the attribut.
>>>
>>> Could somebody help me?
>>> Oliver
>>>
>>>
>>>
>>
>
>
0
oliver
4/14/2009 6:55:18 PM
Reply:

Similar Artilces:

add values to multiple-valued attribute error
try add multiple values to a mulitple-valued attribute (that can be done with a GUI / LDIF).However, use following code, I get error when insert multiple values for Properties("mgrpRFC822MailMember") (but it works with only one entry)Any help is very welcome.Thx Dim de1 = New DirectoryEntry("LDAP://" & ldapServerName & _            "/ou=MailGroup,dc=pcihl,dc=com", "cn=Manager,dc=pcihl,dc=com", "secret", AuthenticationTypes.ServerBind)            Dim newLstEntry As Direct...

Using specific values from multi-valued attributes via LDAP?
I understand how to inject LDAP attribute data in to the authentication process via the form fill, but is there a way to select a specific value from a multivalued attribute? Say for example that I have an attribute called "myPasswords" that has multiple string values specifying a URL and a stored password. I'd need to be able to search for the value needed for the URL I'm authenticating to, then parse out the password section of that string and inject it in to the "password" box in the form. Possible? Not possible? ---------------------------------...

Multi-valued attribute to single attribute conversion
Afternoon Everyone! I have been trying to use the default rule in the AD driver to strip multi-valued attributes but for a modify operation but without any luck. I made a copy and put it in the Command Transformation. Would someone please give me asome pinters. I keep getting LDap Error 21, Invalid syntax. Error in attribute conversion operation. Here is the rule I am attempting using: <rule> <description>Convert multi-valued Telephone to single value</description> <conditions> <and> <if-operation op="equal">modify<...

how to replace attribute values?
Hi guys, I know that if I can update a property like this:If (User.Properties.Contains("test")) Then    User.Properties("test")(0) = "testing 1" 'Update itElse 'It does not exist, so add it    User.Properties("test").Add("testing 2")end ifHowever, If i add the values as multiple values, e.g. User.Properties("test").AddRange(New Object() {"text 1", "text 2"})how can i update it? First remove and then add?  How to do so? If you want to replace the values, you can either remove all the values and then add the new ones or more easily you can just use the .Val...

Multiple attribute value
C#, web form, VS 2005.  Thank you in advance for reading/helping.Working with XML returned from a web service,  have some nodes that have the same name but different attribute values. Ex.<ReceivedRecords pk=""/><ReceivedRecords pk="1234.56"/><ReceivedRecords pk="789.00"/>I'm setting the value of the XML to a text box using xPath...here is the code://Grab value of returned XML at this location.XmlNodeList xmn30 = mydoc.SelectNodes("/Envelope/Body/Response/Contract/ReceivedRecords/@pk");//Output the results to a text boxtxtReceivedRecords.Text = (xmn30[0].InnerText)...

Mutli-valued attribute to multi-valued attribute
We want to synchronize a multi-valued attribute (created by our own) to a multi-valued attribute in the other edirectory store. But when we are adding attributes we only have the changed values. The previous one is lost. When deleting one value in the Identity Vault then it removes the attribute from the object. Any ideas ? > We want to synchronize a multi-valued attribute (created by our own) to a > multi-valued attribute in the other edirectory store. But when we are > adding attributes we only have the changed values. The previous one is > lost. When deleting ...

LDAP Attribute Values
Hi everyone,Is it possible to have dynamic/virtual attribute values for the LDAP owner attribute.  For example, if I have an owner attribute value set for an OU (organizational unit), can all users in that OU have that same owner attribute value dynamically assigned to them?Thanks. I am not sure what you mean.  Are you asking is there an AD supported way to infer that objects in an OU belong to the same owner of the OU?  Not really is the answer.  There are things like security ownership and things like 'managedBy' attribute that can show the 'owner' of an...

LDAP attribute Map / LIst / extend the LDAP attributes
we are use ladp on netware 65, is there a list of the LDAP attributes avaliable that are used for eDirectory 8.7? is it possible to create a ldap attribute that contains more that one edirectory attribute content and extend it with a static variable? any ideas HELGE -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Most eDirectory attributes are available natively by their name (minus spaces and special characters). For example fullname works to retrieve the 'Full Name' and givenname works for 'Given Name' and sasloginconfiguration works for 'SAS:...

One attribute value to two attributes/ values in eDir
Collective, I have a very interesting issue. I have the need to break one attribute that is in AD (ADval1) to two attributes in eDir (attrval1 and attrval2) . Basically what I want to do is take ADval1 and break that data into the two other attributes, attrval1 and attrval2. The attribute in AD looks like this: AD attribute value data 1 | value data 2 In eDir it looks like this: eDir attribute 1 vlaue data 1 eDir attribute 2 value data 2 I don't know if that's clear, when it was explained to me it was a white board. Has anyone tried this or have any id...

Adding an attribute with multiple values.
Hi, It maybe a simple question. But I'm having some troubles with it. I'm using Net::LDAP::Entry and I'm trying to add an attribute with multiple values. Unfortunately, until now it didn't work out. A simple example: attr: value1 attr: value2 Just calling entry's add method multiple times does not worked out. Replace method didn't work out ether. Maybe I'm doing something wrong. Could someone give me an better idea or exemple on how to solve this problem? Thanks in advance, -- Relho de Couro On 11/11/04 8:15 pm, Relho de Couro <r...

Returning Multiple Value Attributes
--LTeJQqWS0MN7I/qa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi List, I am using Net::LDAP and i am trying to return an attribute in a d= n that has multiple values. When I do the search and use $entry->get_value(= $attr ) it only returns the one value. Is there a way returning multiple a= ttribute values? Many thanks --=20 slr, ISP Systems Specialist Telkom Internet #qmail-ldap @ irc.freenode.net This message has been made from 100% recycled bits. ----BEGIN GEEK CODE BLOCK----- Version: 3.12...

I cannot list multiple values for the same attribute
--00504502e1b31c762a04aa3cd03d Content-Type: text/plain; charset=ISO-8859-1 Hi everyone, I am new to perl-ldap and like it very much, however I have a problem I cannot solve by myself (or using google). I have some attributes with multiple values in the same entry, such as: description: abc description: def description: ghi .... I perform a search using a base & filter, then try to list all attributes and their values in a foreach loop: foreach my $entry ($searchResults->entries) { foreach my $attr ($entry->attributes) { for ($attr) { if (/^...

Replace a value of a current attribute?
I need to "adjust" the full name field in our eDirectory It doesn't look like (in consoleone anyway) that this is a multi-valued attribute. Nor do I want/need it to be. Would my ldif thingy look like? dn: cn=dcschmid,ou=SOME,o=ABC changetype: modify replace: fullName fullName: Drew Schmidt ??? -- kjhurni ------------------------------------------------------------------------ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Yes. Good luck. kjhurni wrote: > I need to "adjust" the full name field in our eDirectory >...

LDAP attributes do not exist when they have no value?
I'm coding against LDAP on eDir 8.7. I noticed that when I searched for a particular user object (for example) and tried to retrieve the givenName attribute (for example), that if the user's givenName was set to blank/empty or never populated at all, that the givenName attribute would not even exist. When I populate the givenName (via NWAdmin or any tool), the givenName attribute appears and I can query it via LDAP. If I reset the givenName to a blank, it once again disappears. I have confirmed this using a tool which does a raw dump of all the LDAP attributes of an object. ...

Web resources about - How to replace multiple values of an attribute - perl.ldap

Attribute - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Template:Attributes of God - Wikipedia, the free encyclopedia
Language: English Română Home Random Template:Attributes of God Part of a series on the Attributes of God Aseity Eternity Graciousness Holiness ...

Six Attributes Of The Perfect Facebook Page Administrator
So, here’s the thing: In many ways, hiring a Facebook page administrator is akin to hiring a poster child for your brand. This trusted manager ...

PANDA: Pose Aligned Networks for Deep Attribute Modeling - Facebook
We propose a method for inferring human attributes (such as gender, hair style, clothes style, expression, action) from images of people under ...

Facebook announces data partnerships to help advertisers target users by offline purchases and attributes ...
... will anonymously match data from consumer loyalty programs with user profiles in order to target ads by offline purchase habits and other attributes. ...

New Study Attributes Rapid Ageing Mainly To Environment Factors
New study explains why some people age faster than others.

Should I use the nofollow attribute on internal links? - YouTube
Regarding "nofollow" on internal links: Does it hurt? Does it help? I read different comments from Matt on this matter over time. What's the ...

Justin Trudeau attributes abortion stance to father's example
Liberal Leader Justin Trudeau says he is following an example set by his famous father when it comes to his position on election candidates and ...

Obama attributes western U.S. wildfires to climate change
... that has burned nearly 400 square miles in the north-central part of Washington state, along with blazes in other Western areas, can be attributed ...

Fifty Shades Of Grey Baby Births: Windsor Hospital Sees Spike In Births, Attribute Book
A significant spike in baby births at a hospital in Windsor, Ontario, has been attributed to the book Fifty Shades of Grey, which has become ...

Resources last updated: 12/13/2015 5:51:43 AM