【问题标题】:Role/Privilege overview CRM角色/权限概述 CRM
【发布时间】:2012-03-17 17:22:52
【问题描述】:

我正在开发 MS CRM 4.0。

是否有可能显示每个实体的所有角色及其权限的概览? 例如,我需要它在 excel 中向客户展示它。 它应该是这样构建的:

  • 角色名称
    • 实体名称
      • 创建:组织
      • 阅读:组织
      • 写作:业务部门
      • ...

有这个功能吗? 我使用了很多角色和自定义实体,手动完成需要做很多工作。

【问题讨论】:

    标签: dynamics-crm roles crm dynamics-crm-4 privileges


    【解决方案1】:

    我在 MSDN 上找到了这个示例,它应该可以满足您的要求。 http://archive.msdn.microsoft.com/CrmSecurityReports

    单击下载选项卡。 zip 包含四个报告,以按安全角色和/或业务部门显示权限。按角色有 2 个报告,按用户有 2 个报告。

    这是来自名为 RolePrivileges.sql 的文件,应该可以满足您的需求:

    -- Query on entity roles, consolidating records
    select RoleName, BusinessUnitName, EntityName
    , max([Read]) as [Read], max([Write]) as [Write], max([Append]) as [Append], max([AppendTo]) as [AppendTo]
    , max([Create]) as [Create], max([Delete]) as [Delete], max([Share]) as [Share], max([Assign]) as [Assign] 
    from                                                                                                
    -- Use sub query to split rights into columns, then outer query gets the Depth
    (select r.name as RoleName, r.businessunitidname as BusinessUnitName, e.Name as EntityName
    , isnull(case when p.AccessRight & 1  0 then max(rp.PrivilegeDepthMask) end, 0) as [Read]         
    -- Use AccessRight to determine action
    , isnull(case when p.AccessRight & 2  0 then max(rp.PrivilegeDepthMask) end, 0) as [Write]
    , isnull(case when p.AccessRight & 4  0 then max(rp.PrivilegeDepthMask) end, 0) as [Append]
    , isnull(case when p.AccessRight & 16  0 then max(rp.PrivilegeDepthMask) end, 0) as [AppendTo]
    , isnull(case when p.AccessRight & 32  0 then max(rp.PrivilegeDepthMask) end, 0) as [Create]
    , isnull(case when p.AccessRight & 65536  0 then max(rp.PrivilegeDepthMask) end, 0) as [Delete]
    , isnull(case when p.AccessRight & 262144  0 then max(rp.PrivilegeDepthMask) end, 0) as [Share]
    , isnull(case when p.AccessRight & 524288  0 then max(rp.PrivilegeDepthMask) end, 0) as [Assign]
    from 
        dbo.FilteredRole r
        join dbo.RolePrivileges rp on r.roleid = rp.roleid
        join dbo.FilteredPrivilege p on rp.privilegeid = p.privilegeid
        join dbo.PrivilegeObjectTypeCodes potc on p.privilegeid = potc.privilegeid
        join MetadataSchema.Entity e on potc.ObjectTypeCode = e.ObjectTypeCode
    group by 
        r.name, r.businessunitidname, e.Name, p.AccessRight) as Role
    group by 
        RoleName, BusinessUnitName, EntityName

    【讨论】:

      猜你喜欢
      • 2011-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-15
      • 1970-01-01
      • 1970-01-01
      • 2014-02-03
      相关资源
      最近更新 更多