Example #1
0
 public void testGetCurrentUserGroups() {
   Account[] groups = Advapi32Util.getCurrentUserGroups();
   assertTrue(groups.length > 0);
   for (Account group : groups) {
     assertTrue(group.name.length() > 0);
     assertTrue(group.sidString.length() > 0);
     assertTrue(group.sid.length > 0);
   }
 }
Example #2
0
  public static void main(String[] args) {
    junit.textui.TestRunner.run(Advapi32UtilTest.class);
    String currentUserName = Advapi32Util.getUserName();
    System.out.println("GetUserName: "******" " + group.fqn + " [" + group.sidString + "]");
    }

    Account accountByName = Advapi32Util.getAccountByName(currentUserName);
    System.out.println("AccountByName: " + currentUserName);
    System.out.println(" Fqn: " + accountByName.fqn);
    System.out.println(" Domain: " + accountByName.domain);
    System.out.println(" Sid: " + accountByName.sidString);

    Account accountBySid = Advapi32Util.getAccountBySid(new PSID(accountByName.sid));
    System.out.println("AccountBySid: " + accountByName.sidString);
    System.out.println(" Fqn: " + accountBySid.fqn);
    System.out.println(" Name: " + accountBySid.name);
    System.out.println(" Domain: " + accountBySid.domain);
  }