Use "Member of" table type function with Win logins

SPost29SPost29 Member Posts: 148
I used to use the "member of" table to find if a user belonged to a certain role. It was simple and straight forward.
That was with database logins. How can I do this same type of process with windows logins?
Or more specifically, How can I determine if a windows login is a member of the SUPER role?

Thanks for your help
Steve

Also how do I search the forum to find the "member of" table examples? I couldn't get specific results.

Answers

  • PeterDPeterD Member Posts: 66
    Have a look at table Windows Access Control.
  • rsaritzkyrsaritzky Member Posts: 469
    SPost29 wrote:

    Also how do I search the forum to find the "member of" table examples? I couldn't get specific results.

    Here's a snippet of code that may help you. We have both database logins and Windows logins. Here, I'm checking to see if a userid has a specific role. I first check the "Member Of" table (record variable MemberOf). If nothing found, then I check the Windows Access Control table (Record variable WAC). Note that the Windows Access Control table contains the domain name in the Login name, e.g. user John would be listed as DOMAIN\JOHN, where DOMAIN is your actual domain.

    Take a look at the "Member Of" and "Windows Access Control" tables - they are pretty straightforward and you should be able to figure out things from there. If you have any other specific questions, post them here.
      // Check for Security Role VOIDCHECK which will allow/restrict voiding of checks
      MemberOf.RESET;
      MemberOf.SETRANGE("User ID", USERID);
      MemberOf.SETRANGE("Role ID", 'VOIDCHECK');
      IF NOT xMemberOf.FINDFIRST THEN BEGIN
        WAC.RESET;
        WAC.SETRANGE("Login ID", 'DOMAIN\' + USERID);
        WAC.SETRANGE("Role ID", 'VOIDCHECK');
        IF NOT WAC.FINDFIRST THEN
          ERROR('You do not have permission to void checks.');
      END;
    
    Ron
  • SPost29SPost29 Member Posts: 148
    Ron,
    Thanks for your help. I'll try it out
    Steve
Sign In or Register to comment.