Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Need API to access the user group to which a currently logged in user belongs

Need API to access the user group to which a currently logged in user belongs

Scheduled Pinned Locked Moved C / C++ / MFC
jsonquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Worried
    wrote on last edited by
    #1

    Hi, I am looking for an API that will return the 'group' to which the currently logged in user belongs. Or is it a way to know if the currently logged in user belongs to a paricular user group?

    H T 2 Replies Last reply
    0
    • W Worried

      Hi, I am looking for an API that will return the 'group' to which the currently logged in user belongs. Or is it a way to know if the currently logged in user belongs to a paricular user group?

      H Offline
      H Offline
      humps
      wrote on last edited by
      #2

      Hi there, Do you mean you want to list the groups of the user running your program? I think the process is (sorry I don't have any example code): ImpersonateSelf() - to generate an access token for the current process OpenThreadToken() - to open the access token GetTokenInformation() specifying TokenPrimaryGroup or TokenGroup as one of the parameters - to get a data structure with group information Then walk the structure from this last function, looking for the group SID or SIDs. Finally, to convert a SID to an actual text group name, use: LookupAccountSid() Hope this is a pointer in the right direction ! Thanks, Neil Humphreys.

      1 Reply Last reply
      0
      • W Worried

        Hi, I am looking for an API that will return the 'group' to which the currently logged in user belongs. Or is it a way to know if the currently logged in user belongs to a paricular user group?

        T Offline
        T Offline
        ThatsAlok
        wrote on last edited by
        #3

        look at NetUserGetLocalGroups defined in LM.h under PSDK


        "I Think this Will Help" [Vote One Here,.....]

        visit me at http://www.thisisalok.tk
        W 1 Reply Last reply
        0
        • T ThatsAlok

          look at NetUserGetLocalGroups defined in LM.h under PSDK


          "I Think this Will Help" [Vote One Here,.....]

          visit me at http://www.thisisalok.tk
          W Offline
          W Offline
          Worried
          wrote on last edited by
          #4

          Thanks guys....

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups