Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2491

Re: How to check if User has admin privileges or not ?

Newsgroups comp.lang.java.help
Date 2013-02-11 14:00 -0800
References <ef3534d3-9fe1-46d8-9eaa-06008049a586@h40g2000prf.googlegroups.com> <eb5757a6-fdee-49d0-b8bc-a7dfd3fcf42a@googlegroups.com>
Message-ID <6600bb46-93e7-4890-a8f5-17bfc421cb80@googlegroups.com> (permalink)
Subject Re: How to check if User has admin privileges or not ?
From Lew <lewbloch@gmail.com>

Show all headers | View raw


aki...@gmail.com wrote:
> Matrixinline wrote:
>> Can we check the user has admin privileges or not on the local system
>> through Java ?
> 
> Anup did you find a solution to this? I am running into similar issues please let me know. I would appreciate your help.

It is unlikely that Anup will answer after over four years. You would have been better off just 
asking your question in the newsgroup.

You can use JNI, but why should Java know if a user has admin privileges? That is system-specific, 
and not really Java's job.

Even if a user has admin privileges, the program might be restricted from performing certain actions.

The usual means is to try what you need to do and catch exceptions. Warn the user if they're running 
the program with insufficient privilege or whatever.

You could also RTFM for API calls that might help you.

This might, for example, turn up 
http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exec(java.lang.String)
and related calls that would let you call out to the system to determine rights.

Do you know how to determine the user's rights with OS-specific utilities?

Again, next time just start a new thread. Years-old threads aren't likely to be much help.

-- 
Lew

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: How to check if User has admin privileges or not ? akinny@gmail.com - 2013-02-11 13:19 -0800
  Re: How to check if User has admin privileges or not ? Lew <lewbloch@gmail.com> - 2013-02-11 14:00 -0800
  Re: How to check if User has admin privileges or not ? Roedy Green <see_website@mindprod.com.invalid> - 2013-02-17 14:37 -0800

csiph-web