• Post Reply Bookmark Topic Watch Topic
  • New Topic

Determine whether user is admin  RSS feed

 
Patrick Ehlert
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know how you can determine whether the user that is running your Java program is an (Windows) administrator or not?
I know that you can get the user's account name with:

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

But there doesn't seem to be a "user.type" property or something? I can't find any information on how to do this anywhere... Is it even possible in Java?
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of Java's strongest benefits (if not the strongest) is its Write Once, Run Anywhere (WORA) philosophy. An unfortunate side affect of this is that there are certain things that vary too greatly from platform to platform to handle in a unified way. User and user group definitions likely fall within that category. To the best of my knowledge, Java does not support the concept of user groups. Instead, it uses Security Policies to apply restrictions and grant permissions. I do not have a lot of experience with such since most of my work is with Web Applications and the web container provider authentication and authorization services for my applications. I suggest you look at the Sun Security Features in Java SE tutorial. It may hep you accomplish what you want to ultimately do.

Others may have other comments and suggestions.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!