I\'m working on MS CRM plugin, and it should be able to determine whether the current user has write access to the current entity. I don\'t know how to approach this task.>
According to Matt's Answer:
You have just have to perform the joins and add the where clause you care about. Here is the Equivalent SQL:
SELECT Privilege.*
FROM Privilege
INNER JOIN RolePrivilege ON Privilege.PrivilegeId = RolePrivilege.PrivilegeId
INNER JOIN SystemUserRole ON SystemUserRole.RoleId = RolePrivileges.RoleId AND SystemUserRole.SystemUserId = (user's GUID)
-- WHERE Add whatever constraints on the Privilege entity that you need
You can perform this using Fetch XML, or LINQ to CRM, or Query Expressions, or even OData.