locked
HTML5 App: Trying to get all of a user's security groups so I can check their permissions as well RRS feed

  • Question

  • Hi guys, I need to implement Product-level security, where an user needs to be assigned permission to view individual products. I do this by maintaining a ProductUsers table which has an aspnet_user and a aspnet_role (Product Reader, Product Writer, Product Admin). On an individual level, this works just fine. However, I now need to programatically check if, on a PRODUCT level (which I do using my SecurityHelper class), an aspnet_user (who is authenticated using Windows AD authentication) belongs to any group that has the permission.

    In other words, I have a System Administrator who adds aspnet_users, and then Product Adminstrators who add these aspnet_users to individual Products. I need to be able to check if either the user has explicitly been granted a role for this client OR the user belongs to a group with this client.

    When I try to import System.DirectoryServices.AccountManagement, it doesn't show up:

    Error 17 The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?)

    However I have certainly added a reference. Anybody have a reasonable workaround?

    Friday, January 30, 2015 8:36 AM

Answers

  • HI Matt,

    If you need to check many permissions throughout your HTML client app or you need to return permissions to custom web clients you build against the LightSwitch server, a better idea is to retrieve all these permissions at once for the logged in user and store them on the client so all screens can access them without hitting the database again.  Further resource: LightSwitch ServerApplicationContext and WebAPI to Get User Permissions

    hope it helps you.

    Best regards,

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Angie Xu Monday, February 9, 2015 1:32 AM
    Monday, February 2, 2015 7:48 AM