How to check access level of user on any system

前提是你 提交于 2019-12-07 20:19:27
gtiwari333

You can retrieve the logged in user's name as :

String user=System.getProperty("user.name"); 

You can retrieve the logged in user detail as described in java-forums.org:

public static void ntSystemDetails() {

    com.sun.security.auth.module.NTSystem NTSystem = new com.sun.security.auth.module.NTSystem();

    System.out.println(NTSystem.getName());
    System.out.println(NTSystem.getDomain());
    System.out.println(NTSystem.getDomainSID());

    System.out.println(NTSystem.getImpersonationToken());
    System.out.println(NTSystem.getPrimaryGroupID());
    System.out.println(NTSystem.getUserSID());
    for (String group : NTSystem.getGroupIDs()) {
        System.out.println("Groups  " + group);
    }
}

If you get an error like this :

   NTSystem is not accessible due to restriction on required library ...

then , follow the following steps as described in https://stackoverflow.com/a/2174607/607637

To know about Well-known security identifiers in Windows operating systems, see this page http://support.microsoft.com/kb/243330

Then I hope that you get enough hints.

You may try using the activities mechanism for this. Have a look at this

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!