Microsoft Dynamic CRM 2011:针对特定安全角色和帐户所有者的字段级安全性

发布于 2024-11-06 06:05:55 字数 175 浏览 0 评论 0原文

我的公司正在使用 Microsoft Dynamic CRM 2011 并且想要自定义一些功能。定制如下:

“有账户密码字段(用于登录我们公司网站)。密码仅对帐户所有者或销售经理或销售管理员可见。”

我该怎么做,MSCRM 2011 中的现场安全似乎只支持用户和团队。请告诉我该怎么做(甚至通过编程)。

My company is using Microsoft Dynamic CRM 2011 and want to customize some features. A customization as described below:

“There is the password field of the Account ( used to login our company website). The password is only visible to account’s owner or to sale manager or to sales admin.”

How can I do that, that seem Field Security in MSCRM 2011 only support for User and Team. Please tell me how to do ( even by programming).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凡间太子 2024-11-13 06:05:55

现场安全非常适合特定角色(销售经理等),但不适用于“上下文感知”场景,例如记录所有者。

您最好的选择是为密码创建一个自定义实体,使主字段(默认名称)不是业务所需的。

创建与客户的 N:1 关系,将关系设为“父级”并将查找字段设为“业务必填”。
您现在将在帐户的左侧导航中看到“密码”。

编辑密码表单以查找帐户,并添加密码本身的文本字段,并使“名称”字段默认不可见,以便您可以忽略它。

创建安全角色(或编辑现有角色)以授予用户级别的密码访问权限,以执行读取、创建、更新、分配和附加权限。修改销售经理角色以允许读取所有密码记录。

父母关系意味着,如果重新分配帐户,则儿童密码记录也会如此。
但是,某人可以创建一个密码记录(因此他们拥有它)并将其链接到一个帐户(甚至可能不是他们拥有的帐户),而无需更改所有者以匹配父级。因此,在密码记录创建、重新设置父级或重新分配上创建一个工作流程,将所有者更改为与父帐户相同的帐户,以解决这种情况。

编辑密码的关联视图以显示密码字段。根据需要编辑其他视图。 (如果您确实希望密码直接在帐户表单上可见,请使用内联网格集来使用最小的空间,没有视图选择器等。但实际上仍然占用太多空间。)

希望这会有所帮助

Field Security would be great for particular roles (sales manager etc) but not for "context aware" scenarios eg for the owner of the record.

Your best bet would be to create a custom entity for Password, make the primary field (name by default) NOT business required.

Create an N:1 relationship to Account, make the relationship "Parental" and make the lookup field Business Required.
You will now see "Password" in the left navigation of the Account.

Edit Password form to have lookup to Account, and add text field for the password itself, and make the "name" field not visible by default so you can ignore it.

Create a security role (or edit existing ones) to give User level access rights to Password for the read, create, update, assign, and append privileges. Amend sales manager role to allow to read all Password records.

The parental relationship will mean that if an Account is re-assigned then so will the child Password record.
But, someone could create a password record (so they own it) and link it to an Account (even one they don't own, possibly), without changing the owner to match the parent. So, create a workflow on the Password record create, re-parent or re-assign which will change the owner to the same as the parent account to tidy up this situation.

Edit the associated view for passwords to show the password field. Edit other views as required. (If you really want password visible on the Account form directly, use an inline grid set to use a minimum of space, no view selector etc. Still takes up far too much though, in reality.)

Hope this helps

你对谁都笑 2024-11-13 06:05:55

这可以通过使用 javascript 来实现。

首先,将密码字段设置为默认不可见 - 这将阻止它最初出现,以便没有权限的用户可以看到它(即使是短暂的)。

其次,提供一个 javascript 函数来查找登录用户的角色。有很多方法可以做到这一点,每种方法都有自己的优点和缺点。此链接有一个您可以使用的几种方法。

第三,使用此函数和一些额外的 JavaScript 来检查所有者字段以使该字段可见/不可见。

举个例子:

function CanUserSeePassword() {
    var loggedInUserGuid = USER_ID;//USER_ID is built in CRM constant
    if (RetrieveUserRoles(loggedInUserGuid)) {
        SetPasswordFieldVisibility(true);
    }
    else {
        var ownerGuid = Xrm.Page.getAttribute('ownerid').getValue()[0].id;
        SetPasswordFieldVisibility(ownerGuid == USER_ID);
    }
}

function SetPasswordFieldVisibility(isVisible) {
    Xrm.Page.getAttribute('new_password').setVisible(isVisible);
} 

function RetrieveUserRoles() {
    //use code from link above to return a bool, either user is in appropriate security role, or is not
}

准备工作有点粗糙,但可以完成工作。

This would be possible by using javascript.

Firstly, set the password field to not be visible by default - this will stop it appearing initially so that a user without permissions might see it (even briefly).

Secondly, provide a javascript function to look up the logged in user's roles. There are many ways of doing this, each with its own advantages and disadvantages. This link has a couple of ways you could use.

Thirdly, use this function and some extra javascript to check for the owner field to make the field visible/invisible.

As an example:

function CanUserSeePassword() {
    var loggedInUserGuid = USER_ID;//USER_ID is built in CRM constant
    if (RetrieveUserRoles(loggedInUserGuid)) {
        SetPasswordFieldVisibility(true);
    }
    else {
        var ownerGuid = Xrm.Page.getAttribute('ownerid').getValue()[0].id;
        SetPasswordFieldVisibility(ownerGuid == USER_ID);
    }
}

function SetPasswordFieldVisibility(isVisible) {
    Xrm.Page.getAttribute('new_password').setVisible(isVisible);
} 

function RetrieveUserRoles() {
    //use code from link above to return a bool, either user is in appropriate security role, or is not
}

Bit rough 'n' ready, but will do the job.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文