gpt4 book ai didi

c# - 在 dynamics crm 中获取用户的上下文

转载 作者:太空宇宙 更新时间:2023-11-03 10:27:26 24 4
gpt4 key购买 nike

我在 dynamics crm 中有一个用户列表,我希望在创建 crm 上下文时只有一个用户的上下文,即该用户将无法访问其他用户的记录。

我尝试像这样更改 organizationproxy 的调用者:

                //original context
OrganizationServiceContext contextORI = new OrganizationServiceContext(organisationProxy);
//i search th user
Utilisateur user= (from k in contextORI.CreateQuery<Utilisateur>()
where k.Id == User.Id
select k).FirstOrDefault();
//i change the caller of organisationProxy
this.organisationProxy.CallerId = user.Id;
//i create the new context
OrganizationServiceContext context = new OrganizationServiceContext(organisationProxy);

但用户始终可以访问所有结果

当我使用 WhoAmIRequest 进行验证时,我仍然找到了旧用户。

你知道如何切换用户吗?

最佳答案

似乎您的用户在分配的安全角色中没有 prvActOnBehalfOfAnotherUser 权限。

User account (A) needs the privilege prvActOnBehalfOfAnotherUser, which is included in the Delegate role.

Alternately, for Active Directory directory service deployments only, user account (A) under which the impersonation code is to run can be added to the PrivUserGroup group in Active Directory. This group is created by Microsoft Dynamics CRM during installation and setup. User account (A) does not have to be associated with a licensed Microsoft Dynamics CRM user. However, the user who is being impersonated (B) must be a licensed Microsoft Dynamics CRM user.

The actual set of privileges that is used to modify data is the intersection of the privileges that the Delegate role user possesses with that of the user that is being impersonated. In other words, user A is allowed to do something if and only if user A and the impersonated user (B) have the privilege necessary for the action.

Source

关于c# - 在 dynamics crm 中获取用户的上下文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31243117/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com