Hi
When you move an AX Database from different domain, is necessary to update the AD User SID.
Below a nice job.
Enjoy !
static void UpdateSID(Args _args)
{
UserInfo UserInfo;
AxaptaUserManager aUserManager = new AxaptaUserManager();
DomainName networkDomain;
Sid sid;
;
networkDomain = (select networkDomain from UserInfo
where UserInfo.id == curUserId()).networkDomain;
info(networkDomain);
while select forUpdate UserInfo
where UserInfo.networkAlias
&& UserInfo.id != "Guest"
{
try
{
ttsBegin;
info(UserInfo.networkAlias);
sid = aUserManager.getUserSid(UserInfo.networkAlias, networkDomain);
if( !sid )
{
warning(strFmt("Utente %1 non presente in active directory, domain %2", UserInfo.name, networkDomain));
continue;
}
UserInfo.networkDomain = networkDomain;
UserInfo.sid = sid;
UserInfo.update();
ttsCommit;
}
catch
{
warning(strFmt("Impossibile modificare l'utente %1", UserInfo.name));
}
}
}
When you move an AX Database from different domain, is necessary to update the AD User SID.
Below a nice job.
Enjoy !
static void UpdateSID(Args _args)
{
UserInfo UserInfo;
AxaptaUserManager aUserManager = new AxaptaUserManager();
DomainName networkDomain;
Sid sid;
;
networkDomain = (select networkDomain from UserInfo
where UserInfo.id == curUserId()).networkDomain;
info(networkDomain);
while select forUpdate UserInfo
where UserInfo.networkAlias
&& UserInfo.id != "Guest"
{
try
{
ttsBegin;
info(UserInfo.networkAlias);
sid = aUserManager.getUserSid(UserInfo.networkAlias, networkDomain);
if( !sid )
{
warning(strFmt("Utente %1 non presente in active directory, domain %2", UserInfo.name, networkDomain));
continue;
}
UserInfo.networkDomain = networkDomain;
UserInfo.sid = sid;
UserInfo.update();
ttsCommit;
}
catch
{
warning(strFmt("Impossibile modificare l'utente %1", UserInfo.name));
}
}
}
No comments:
Post a Comment