UserUpdate

Juan Manuel Clavero Almirón <[email protected]> Tue, 30 Aug 2016 11:16:47 +0000
Newsgroups gmane.comp.otrs.devel
Message-ID <4E6C4135180B424CBFC6C6DE9456154A01258F2AB8@SCPDPSEXMB01P.ssib.local>
--===============8642313345786545200==
Content-Language: es-ES
Content-Type: multipart/alternative;
	boundary="_000_4E6C4135180B424CBFC6C6DE9456154A01258F2AB8SCPDPSEXMB01P_"

--_000_4E6C4135180B424CBFC6C6DE9456154A01258F2AB8SCPDPSEXMB01P_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all,

Sometimes, when an agent was fired and then hired again, he would be valid =
in the LDAP but invalid in OTRS, so I did some scripting (in OTRS 3.1) to a=
uto-enable in OTRS if LDAP bind was succesful. Something like:

1
 2     my %UserData =3D $UserObject->GetUserData(
3         User  =3D> $User,
4     );
5
 6     $UserData{UserID} =3D 1; # valid
7
 8     $UserObject->UserUpdate(
9         %UserData,
10         ChangeUserID =3D> 1,
11     );

Now we want to move to OTRS 5 and I'm migrating our custom code and UserUpd=
ate gives an error because the UserLogin already exists (of course, I want =
to update its info!). If I remove UserID or UserLogin, UserUpdate misses th=
ese parameters.

I've seen the code in User.t and the test for UserUpdate changes the UserLo=
gin.

All my agents are in LDAP and UserData is updated on every login  with Syst=
em::Auth::Sync::LDAP, but I don't get how this one works and mine doesn't

Can anybody explain me how this works now?

Kind regards,
Juan Clavero


--_000_4E6C4135180B424CBFC6C6DE9456154A01258F2AB8SCPDPSEXMB01P_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.EstiloCorreo17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"ES" link=3D"#0563C1" vlink=3D"#954F72">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Hi all,<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Sometimes, when an agent was fired and then hired ag=
ain, he would be valid in the LDAP but invalid in OTRS, so I did some scrip=
ting (in OTRS 3.1) to auto-enable in OTRS if LDAP bind was succesful. Somet=
hing like:<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal" style=3D"background:white;text-autospace:none"><span=
 style=3D"font-size:8.0pt;font-family:Consolas;color:#969696">1
</span><span style=3D"font-size:8.0pt;font-family:Consolas"><o:p></o:p></sp=
an></p>
<p class=3D"MsoNormal" style=3D"background:white;text-autospace:none"><span=
 style=3D"font-size:8.0pt;font-family:Consolas;color:#969696">&nbsp;2
</span><span style=3D"font-size:8.0pt;font-family:Consolas">&nbsp;&nbsp;&nb=
sp;&nbsp;<span style=3D"color:#00A150">my</span>
<span style=3D"color:#A00050">%UserData</span> <span style=3D"color:#323232=
">=3D</span>
<span style=3D"color:#A00050">$UserObject</span><span style=3D"color:#32323=
2">-&gt;</span><span style=3D"color:#C73A69">GetUserData</span><span style=
=3D"color:#323232">(</span><o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"background:white;text-autospace:none"><span=
 style=3D"font-size:8.0pt;font-family:Consolas;color:#969696">3
</span><span style=3D"font-size:8.0pt;font-family:Consolas;color:#323232">&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User</span><span style=3D"fo=
nt-size:8.0pt;font-family:Consolas">&nbsp;
<span style=3D"color:#323232">=3D&gt;</span> <span style=3D"color:#A00050">=
$User</span><span style=3D"color:#323232">,</span><o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"background:white;text-autospace:none"><span=
 style=3D"font-size:8.0pt;font-family:Consolas;color:#969696">4
</span><span style=3D"font-size:8.0pt;font-family:Consolas">&nbsp;&nbsp;&nb=
sp;&nbsp;<span style=3D"color:#323232">);</span><o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"background:white;text-autospace:none"><span=
 style=3D"font-size:8.0pt;font-family:Consolas;color:#969696">5
</span><span style=3D"font-size:8.0pt;font-family:Consolas">&nbsp;&nbsp;&nb=
sp;&nbsp;<o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"background:white;text-autospace:none"><span=
 style=3D"font-size:8.0pt;font-family:Consolas;color:#969696">&nbsp;6
</span><span style=3D"font-size:8.0pt;font-family:Consolas">&nbsp;&nbsp;&nb=
sp;&nbsp;<span style=3D"color:#A00050">$UserData</span><span style=3D"color=
:#323232">{UserID} =3D</span>
<span style=3D"color:#1094A0">1</span><span style=3D"color:#323232">;</span=
> <span style=3D"color:#969696">
# valid</span><o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"background:white;text-autospace:none"><span=
 style=3D"font-size:8.0pt;font-family:Consolas;color:#969696">7
</span><span style=3D"font-size:8.0pt;font-family:Consolas">&nbsp;&nbsp;&nb=
sp;&nbsp;<o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"background:white;text-autospace:none"><span=
 style=3D"font-size:8.0pt;font-family:Consolas;color:#969696">&nbsp;8
</span><span style=3D"font-size:8.0pt;font-family:Consolas">&nbsp;&nbsp;&nb=
sp;&nbsp;<span style=3D"color:#A00050">$UserObject</span><span style=3D"col=
or:#323232">-&gt;</span><span style=3D"color:#C73A69">UserUpdate</span><spa=
n style=3D"color:#323232">(</span><o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"background:white;text-autospace:none"><span=
 style=3D"font-size:8.0pt;font-family:Consolas;color:#969696">9
</span><span style=3D"font-size:8.0pt;font-family:Consolas">&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=3D"color:#A00050">%UserData</s=
pan><span style=3D"color:#323232">,</span><o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"background:white;text-autospace:none"><span=
 style=3D"font-size:8.0pt;font-family:Consolas;color:#969696">10
</span><span style=3D"font-size:8.0pt;font-family:Consolas;color:#323232">&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ChangeUserID</span><span sty=
le=3D"font-size:8.0pt;font-family:Consolas">
<span style=3D"color:#323232">=3D&gt;</span> <span style=3D"color:#1094A0">=
1</span><span style=3D"color:#323232">,</span><o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"background:white;text-autospace:none"><span=
 style=3D"font-size:8.0pt;font-family:Consolas;color:#969696">11
</span><span style=3D"font-size:8.0pt;font-family:Consolas">&nbsp;&nbsp;&nb=
sp;&nbsp;<span style=3D"color:#323232">);</span><o:p></o:p></span></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Now we want to move to OTRS 5 and I&#8217;m migratin=
g our custom code and UserUpdate gives an error because the UserLogin alrea=
dy exists (of course, I want to update its info!). If I remove UserID or Us=
erLogin, UserUpdate misses these parameters.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I&#8217;ve seen the code in User.t and the test for =
UserUpdate changes the UserLogin.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">All my agents are in LDAP and UserData is updated on=
 every login&nbsp; with System::Auth::Sync::LDAP, but I don&#8217;t get how=
 this one works and mine doesn&#8217;t<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Can anybody explain me how this works now?<o:p></o:p=
></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><span style=3D"color:#1F497D;mso-fareast-language:ES=
">Kind regards,<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,sans-serif;color:#1F497D;mso-fareast-language:ES">Juan Clavero</s=
pan><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-family:&quot;Arial&=
quot;,sans-serif;color:#1F497D;mso-fareast-language:ES"><o:p></o:p></span><=
/p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>

--_000_4E6C4135180B424CBFC6C6DE9456154A01258F2AB8SCPDPSEXMB01P_--

--===============8642313345786545200==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
OTRS mailing list: dev - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/dev
To unsubscribe: http://lists.otrs.org/mailman/listinfo/dev
--===============8642313345786545200==--