locked
How to retrieve CRUD rights of current user in Silverlight RRS feed

  • Question

  • Hi,

    Currently I'm developing a Silverlight plugin that visualizes Accounts and Contacts in a mindmap sort of way.
    In these entities, I'm displaying links to create a new Quote, Order, Case,... These links take you to the corresponding CRM screen.
    This is working as it should, but not all users have the right to create a new Quote, Order, Case,... So I'm wondering if it's possible to retrieve this info from the ODATA endpoint?
    So basically I want to know the CRUD permissions from the current logged in user to disable certain links if the current user is not authorized to go to that page.
    Thanks in advance.

    Kind regards,

    Arne Deruwe

    Tuesday, March 8, 2011 1:56 PM

Answers

  • You can find the user Role privileges by looking at the RolePrivilegesSet. This contains the RoleId (from the RoleBase Table) and PrivilegeId (from the PrivilegeBase Table) you will need to locate the users role id's (maybe using the Client api Xrm.Page.context.getuserRoles()) and required privilege id's (look in the db) or use the query tool by querying the PrivilegeSet.  


    MSCRM Bing'd - http://bingsoft.wordpress.com
    Check out the CRM 4 to CRM 2011 JavaScript Converter Tool
    CRM Forum Guidance on how to Help Us Help You
    • Marked as answer by Arne Deruwe Thursday, March 17, 2011 11:40 AM
    Thursday, March 17, 2011 11:36 AM
    Moderator

All replies

  • I dont know if this is provided by the odata endpoint.

     

    What you can do is using the SOAP endpoint for this part of your application and using the execute method.

    http://msdn.microsoft.com/en-us/library/gg594452.aspx#Y1126

    Kind regards,

    Markus

    Tuesday, March 8, 2011 10:41 PM
  • Hi,

    I would be surprised if it weren't possible.. Can anyone confirm this?
    Right now I'm able to fetch the current user and I'm expanding his roleprivileges_association property. It seems that the CRUD rights are in that collection, but I'm not understanding the accessright integer value.. Can anyone please tell me if I'm searching in the right collection? And if yes, how do I interpret the accessright integer value? I'm getting really frustrated with the lack of documentation of the REST endpoint.. If anyone has a good resource on that, I would be very happy if you provided a link (a DB model would be a great start, right now I feel I'm searching at random...).

    Thanks in advance.

    Arne Deruwe

    Wednesday, March 16, 2011 9:40 AM
  • You can discover whats possible with OData by using the CRM 2011 OData Query Designer http://crm2011odatatool.codeplex.com from codeplex

     


    MSCRM Bing'd - http://bingsoft.wordpress.com
    Check out the CRM 4 to CRM 2011 JavaScript Converter Tool
    CRM Forum Guidance on how to Help Us Help You
    Wednesday, March 16, 2011 10:35 PM
    Moderator
  • Hi,

    I'm already using it (great tool BTW). However, designing queries isn't the problem. I'm aware of the limitations for designing queries, but I can't even start to compose queries if I don't know where the data I need is located. So if someone could explain the relationship between a user and his CRUD rights table-relation-wise, I would be good to go.

    Thanks in advance,

    Arne Deruwe

    Thursday, March 17, 2011 8:03 AM
  • You can find the user Role privileges by looking at the RolePrivilegesSet. This contains the RoleId (from the RoleBase Table) and PrivilegeId (from the PrivilegeBase Table) you will need to locate the users role id's (maybe using the Client api Xrm.Page.context.getuserRoles()) and required privilege id's (look in the db) or use the query tool by querying the PrivilegeSet.  


    MSCRM Bing'd - http://bingsoft.wordpress.com
    Check out the CRM 4 to CRM 2011 JavaScript Converter Tool
    CRM Forum Guidance on how to Help Us Help You
    • Marked as answer by Arne Deruwe Thursday, March 17, 2011 11:40 AM
    Thursday, March 17, 2011 11:36 AM
    Moderator
  • This is the info I needed, thank you very much. Any chance Microsoft is going to release a DB schema for CRM 2011?
    Thanks again for your time.

    Arne Deruwe

    Thursday, March 17, 2011 11:39 AM
  • Potentially in the future, as they did for CRM4 but even the CRM 4 schema isn't too far off CRM 2011, mostly just additional tables.
    MSCRM Bing'd - http://bingsoft.wordpress.com
    Check out the CRM 4 to CRM 2011 JavaScript Converter Tool
    CRM Forum Guidance on how to Help Us Help You
    Thursday, March 17, 2011 11:57 AM
    Moderator