简体   繁体   English

另一个用户的AX 2012 R3 AIF系统服务呼叫上下文

[英]AX 2012 R3 AIF System Services Callcontext of another user

Is it possible to call the AIF system services using a callcontext of another user? 是否可以使用其他用户的调用上下文来调用AIF系统服务? I specifically need to fetch which tables a user has access to. 我特别需要获取用户有权访问的表。 By using the method GetAccessRights in the UserSessionService , I can extract which tables I have access to. 通过使用UserSessionService GetAccessRights方法,我可以提取我有权访问的表。 I need to call this for other users, so I tried setting the CallContext.LogonAsUser to another user, but I get the error: 我需要为其他用户调用它,因此我尝试将CallContext.LogonAsUser设置为另一个用户,但出现错误:

An unhandled exception of type 'System.ServiceModel.FaultException' occurred in mscorlib.dll mscorlib.dll中发生了类型为'System.ServiceModel.FaultException'的未处理异常

Additional information: Failed to logon to Microsoft Dynamics AX. 附加信息:无法登录到Microsoft Dynamics AX。

To be able to use LogonAsUser on custom services, I need to set the "Trusted intermediary users" on the inbound port. 为了能够在自定义服务上使用LogonAsUser,我需要在入站端口上设置“受信任的中间用户”。 However, it doesn't seem to be possible to set this on the system services. 但是,似乎无法在系统服务上进行设置。

I'm testing this on a contoso image. 我正在contoso图像上对此进行测试。 I'm logged in as contoso\\Administrator. 我以contoso \\ Administrator登录。

The complete code: 完整的代码:

USSReference.UserSessionServiceClient client = new USSReference.UserSessionServiceClient();

USSReference.CallContext context = new USSReference.CallContext
{
    LogonAsUser = "VishwaR"
};

USSReference.AccessControlledItemKey key = new USSReference.AccessControlledItemKey();
key.ItemType = USSReference.AccessControlledType.Table;
key.ItemName = "CUSTTABLE";

UserService.USSReference.AccessRight[] rights = client.GetAccessRights(context, new USSReference.AccessControlledItemKey[] { key });

You can create custom AIF Inbound Port and add AifUserSessionService.GetAccessRights operation. 您可以创建定制的AIF入站端口,并添加AifUserSessionService.GetAccessRights操作。 Here you can set Allow trusted intermediary to impersonate . 在这里,您可以将“ Allow trusted intermediary to impersonate设置Allow trusted intermediary to impersonate

自定义AIF服务操作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM