本文介绍了的Microsoft Dynamics 4.0 SDK检查,如果用户有权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们previously使用不支持的DLL( Microsoft.Crm.Application.Components.Core ),以检查是否在动态当前用户在阅读权限特定的实体:

We were previously using an unsupported dll (Microsoft.Crm.Application.Components.Core) to check if the current user in Dynamics has read privileges on a specific entity:

Microsoft.Crm.Security.User.HasPrivilege(Microsoft.Crm.Security.User.Current,
 "myentityname, AccessRights.ReadAccess);

我需要做的仅使用支持SDK同样的事情(和CrmService)。

I need to do the same thing using only the supported SDK (and the CrmService).

有人可以就如何使用SDK做到这一点?

Can someone advise on how to accomplish this using the SDK?

推荐答案

您也许可以设计一个获取或QueryEx pression像这样:

You can probably design a Fetch or QueryExpression like so:

  1. 检索的实体特权
  2. 加入对实体roleprivilege,其中privilege.privilegeid = roleprivilege.privilegeid
  3. 加入对实体systemuserrole,其中systemuserrole.roleid = roleprivileges.roleid和systemuserrole.systemuserid =(有问题的用户的GUID)
  4. 然后要么遍历权限或寻求特权,其中privilege.name =prvReadMyEntityName

只是要小心的结果,因为你可能会从不同的角色不同权限的深度,但如果你不关心深那么我认为会做到这一点。

Just be careful on the results, because you may get different privilege depths from different roles, but if you don't care about the depth then I think that'll do it.

这篇关于的Microsoft Dynamics 4.0 SDK检查,如果用户有权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 09:34