简体   繁体   English

如何限制对MS Dynamics CRM中实体列表中特定项目的访问

[英]How to restrict access to specific item in entity list in MS Dynamics CRM

I have several custom entities. 我有几个自定义实体。 There are two users: user1 and user2 . 有两个用户: user1user2

For one entity type I have 2 items in the list. 对于一个实体类型,我在列表中有2个项目。

I need to show only one item for user1 and only second for user2 . 我只需要为user1显示一项,为user2仅显示第二项。

I tried to manage permissions via share dialog, but it can only restrict write permission, but I need to hide item from the list views. 我试图通过共享对话框来管理权限,但是它只能限制写权限,但是我需要从列表视图中隐藏项目。

How can I do that? 我怎样才能做到这一点?

The CRM security model limits access to records using Security Roles. CRM安全模型使用安全角色限制对记录的访问。 You can set up your custom entities with the privilege of Local Read, which only gives users access to read records they own. 您可以使用“本地读取”特权来设置自定义实体,该特权仅使用户能够访问他们拥有的读取记录。

User1 would then own Record1, while User2 would own Record2. 然后,用户1将拥有Record1,而用户2将拥有Record2。

Alternatively, you could also look into having a hierarchy of Business Units, which also segments visibility of data. 另外,您也可以考虑采用业务部门的层次结构,该层次结构还可以细分数据的可见性。

Have a look at How role-based security can be used to control access to entities in Microsoft Dynamics CRM and The security model of Microsoft Dynamics CRM for more information. 了解有关如何使用基于角色的安全性来控制对Microsoft Dynamics CRM中的实体的访问以及Microsoft Dynamics CRM 的安全模型的详细信息。

you can do this function with two Solution. 您可以使用两个解决方案来执行此功能。

Solution 1: Use Field Security Profile, in this solution you have to enable field security option in field Customization , and then go to Customization > customize the system > field Security Profile, then you can see your field that enabled field security option in last session, and then Click on new button and select User 1 and select the permission option what you want between read Update Create for field1 and same as this for field 2 and user 2. (Notice : this option only work when users haven't Administrator Security Role.) 解决方案1:使用Field Security Profile,在此解决方案中,您必须在Field Customization中启用Field Security选项,然后转到Customization> Customize system> field Security Profile,然后您可以在上一个会话中看到启用了Field Security选项的字段,然后单击“新建”按钮,然后选择“用户1”,然后选择所需的权限选项,即在“为字段1更新更新以及与字段2和用户2的更新相同”之间想要的内容。(注意:仅当用户没有管理员安全性时,此选项才起作用角色。)

Solution 2: You can Use Javascript and Handle this action Client Side. 解决方案2:您可以使用Javascript并处理此操作(客户端)。 first you must go to form Customization and add new Library and add this Code. 首先,您必须去定制表格,添加新的库并添加此代码。

function onload() 
{
    checkUser(); 
}  

function checkUser() 
{
    var userID = Xrm.Page.context.getUserId();
    if( userID == "user1 id")
    {
        Xrm.Page.getControl("field1").setVisible(true);
        Xrm.Page.getControl("field2").setVisible(false);
    }
    else if( userID == "user2 id")
    {
        Xrm.Page.getControl("field1").setVisible(false);
        Xrm.Page.getControl("field2").setVisible(true);
    }
}

and then in form on load event call the onload function and over and all things is great :) 然后在on load事件中调用onload函数,一切都很棒:)

I hope your problem solved :) 希望您的问题得到解决:)

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

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