cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mgaredia
Level 4

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;
}
Labels (1)
0 Kudos
(1) Reply
RobertDickau
Flexera Alumni

There's an enhanced version of the Admin Condition custom bean here: http://www.installshield.com/downloads/beans.asp?prod=mpf.
0 Kudos