This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- How to detect Root/Admin Priviledges
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Nov 06, 2006
07:02 PM
How to detect Root/Admin Priviledges
How do I detect if UNIX user is root or not? There is code but I do i use it? WHat is ProductBeanCondition?
public class AdminProductBeanCondition extends ProductBeanCondition
{
public boolean evaluateTrueCondition( )
{
boolean isAdmin = false;
try
{
SecurityService secService = (SecurityService)getProductBean( ).getServices( ).getService(SecurityService.NAME);
isAdmin = secService.isCurrentUserAdmin( );
}
catch(ServiceException e) { /* do something */ }
return isAdmin;
}
public String defaultName( ) { return "Admin Condition"; }
public String describe( )
{
String msg = "User must ";
if (getEvaluate( ) == MUST_NOT_BE_MET) { msg += "not "; }
msg += "have administrative/root privileges.";
return msg;
}
public class AdminProductBeanCondition extends ProductBeanCondition
{
public boolean evaluateTrueCondition( )
{
boolean isAdmin = false;
try
{
SecurityService secService = (SecurityService)getProductBean( ).getServices( ).getService(SecurityService.NAME);
isAdmin = secService.isCurrentUserAdmin( );
}
catch(ServiceException e) { /* do something */ }
return isAdmin;
}
public String defaultName( ) { return "Admin Condition"; }
public String describe( )
{
String msg = "User must ";
if (getEvaluate( ) == MUST_NOT_BE_MET) { msg += "not "; }
msg += "have administrative/root privileges.";
return msg;
}
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Nov 06, 2006
09:42 PM
There's an enhanced version of the Admin Condition custom bean here: http://www.installshield.com/downloads/beans.asp?prod=mpf.
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)