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
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Checking logged user...
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
‎May 20, 2011
12:48 AM
Checking logged user...
Hi,
I am creating an InstallAnywhere project for windows platform. I want to check if the currently logged user has adminrights or not. If not the setup will exit. Also the user should not be admin. It should be a local user with admin rights. Can anyone help me to find the solution.
Thanks.
I am creating an InstallAnywhere project for windows platform. I want to check if the currently logged user has adminrights or not. If not the setup will exit. Also the user should not be admin. It should be a local user with admin rights. Can anyone help me to find the solution.
Thanks.
(14) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 20, 2011
12:50 AM
Please see the InstallAnywhere API documentation, there are APIs that have inherited from InstallShield, there is a method to check if the local user is admin on Windows.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 23, 2011
03:25 AM
hi,
Actually I am using demo version of InstallAnywhere 2010. When I extract IAClasses.zip, i dont get all the classes of InstallShield API mentioned in JavaDoc (Ex- SecurityService). In the Service subdirectory there is only one class ServiceException, all other are missing. Can you explain this problem.
Thanks.
Actually I am using demo version of InstallAnywhere 2010. When I extract IAClasses.zip, i dont get all the classes of InstallShield API mentioned in JavaDoc (Ex- SecurityService). In the Service subdirectory there is only one class ServiceException, all other are missing. Can you explain this problem.
Thanks.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 23, 2011
10:40 AM
Those classes are not in IAClasses.zip but in a different service.jar I think. But I was saying to read the doc, I'm not sure I understand what's the use to you to check directly the classes.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 31, 2011
07:39 AM
Hi pv7721,
to check wheather th logged user is admin I am using the code:
SecurityService service = (SecurityService) ruleProxy
.getService(SecurityService.class);
boolean isAdmin = false;
try {
// Check if the logged user has admin rights
isAdmin = service.isCurrentUserAdmin();
} catch (ServiceException e) {
System.out.println("Exception occured: " + e);
return false;
}
return isAdmin;
I compiled it and added the class file to zip bt its not getting executed is there any problem with the logic.
Thanks alot...
to check wheather th logged user is admin I am using the code:
SecurityService service = (SecurityService) ruleProxy
.getService(SecurityService.class);
boolean isAdmin = false;
try {
// Check if the logged user has admin rights
isAdmin = service.isCurrentUserAdmin();
} catch (ServiceException e) {
System.out.println("Exception occured: " + e);
return false;
}
return isAdmin;
I compiled it and added the class file to zip bt its not getting executed is there any problem with the logic.
Thanks alot...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 31, 2011
08:48 AM
I'm afraid you need to read a little bit more about how IA works. You're not suppose to modify IAClasses.zip, but build your own .jar with the compiled class, and use Execute Custom code action!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 31, 2011
01:29 PM
Hi atulmaurya,
I recommend you to do the following.
Check how a custom rule is written from the sample templates which Installanywere offers you in location where you have installed it.
1.create a .jar file of the compiled class file
2.Navigate to Project-->Rules in the Advanced Designer view
3.Select the Custom Rule and Add the .jar file you created along with its main class name
4.Now Build the project along with your other requirement and try installing it
If you have logged in as admin the rules evaluates to true and the installer proceeds with its execution else terminates
Thanks,
Madhav Pai
Engineering InstallAnywhere
Flexera Software
I recommend you to do the following.
Check how a custom rule is written from the sample templates which Installanywere offers you in location where you have installed it.
1.create a .jar file of the compiled class file
2.Navigate to Project-->Rules in the Advanced Designer view
3.Select the Custom Rule and Add the .jar file you created along with its main class name
4.Now Build the project along with your other requirement and try installing it
If you have logged in as admin the rules evaluates to true and the installer proceeds with its execution else terminates
Thanks,
Madhav Pai
Engineering InstallAnywhere
Flexera Software
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 01, 2011
12:52 AM
hi,
I am using the process mentioned by you. But not gettig the desired result. One thing that I am not getting is that I am using the classes IAclasses.zip and service.jar. Do I need to sign these jars and add in "Configure Dependencies" or InstallAnywhere will automatically detect them because these are inbuild jars in InstallAnywhere.
Thanks
I am using the process mentioned by you. But not gettig the desired result. One thing that I am not getting is that I am using the classes IAclasses.zip and service.jar. Do I need to sign these jars and add in "Configure Dependencies" or InstallAnywhere will automatically detect them because these are inbuild jars in InstallAnywhere.
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 01, 2011
12:57 PM
Normally, the IaClasses.zip is automaticall added, but you need to check Project/Java Add service support for custom code.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 02, 2011
03:59 AM
hi Vlad,
finally i am able to run my first custom rule in InstallAnywhere. Its just returning true/false (not any complex logic).
But when it comes to the rule that I need to write (checking logged user) I am using following code:
import com.installshield.wizard.service.ServiceException;
import com.installshield.wizard.service.security.SecurityService;
import com.zerog.ia.api.pub.CustomCodeRule;
public class AdminWizardBeanRule extends CustomCodeRule {
public boolean evaluateRule() {
boolean isAdmin = true;
try {
// Get the reference to the SecurityService
SecurityService service = (SecurityService) ruleProxy
.getService(SecurityService.class);
// Check if the logged user has admin rights
isAdmin = service.isCurrentUserAdmin();
} catch (ServiceException e) {
System.out.println("Exception occured: " + e);
return false;
}
return isAdmin;
}
public static void main(String args[]) {
AdminWizardBeanRule admin = new AdminWizardBeanRule();
System.out.println(admin.evaluateRule());
}
}
but this code is generating NullPointerException at line:
SecurityService service = (SecurityService) ruleProxy
.getService(SecurityService.class);
But in Java doc its mentioned that CustomCodeRuleProxy object can be referenced by ruleProxy. Can you please tell whats the problem with this code and why its generating that exception. I will be really thankful if you can suggest some solution.
Thanks alot
finally i am able to run my first custom rule in InstallAnywhere. Its just returning true/false (not any complex logic).
But when it comes to the rule that I need to write (checking logged user) I am using following code:
import com.installshield.wizard.service.ServiceException;
import com.installshield.wizard.service.security.SecurityService;
import com.zerog.ia.api.pub.CustomCodeRule;
public class AdminWizardBeanRule extends CustomCodeRule {
public boolean evaluateRule() {
boolean isAdmin = true;
try {
// Get the reference to the SecurityService
SecurityService service = (SecurityService) ruleProxy
.getService(SecurityService.class);
// Check if the logged user has admin rights
isAdmin = service.isCurrentUserAdmin();
} catch (ServiceException e) {
System.out.println("Exception occured: " + e);
return false;
}
return isAdmin;
}
public static void main(String args[]) {
AdminWizardBeanRule admin = new AdminWizardBeanRule();
System.out.println(admin.evaluateRule());
}
}
but this code is generating NullPointerException at line:
SecurityService service = (SecurityService) ruleProxy
.getService(SecurityService.class);
But in Java doc its mentioned that CustomCodeRuleProxy object can be referenced by ruleProxy. Can you please tell whats the problem with this code and why its generating that exception. I will be really thankful if you can suggest some solution.
Thanks alot
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 02, 2011
05:06 AM
hi atulmaurya,
Please use this script i have tuned it up.
import com.installshield.wizard.service.ServiceException;
import com.installshield.wizard.service.security.SecurityService;
import com.zerog.ia.api.pub.CustomCodeRule;
public class AdminWizardBeanRule extends CustomCodeRule
{
public boolean evaluateRule()
{
boolean isAdmin = true;
try
{
SecurityService service = (SecurityService) ruleProxy.getService(SecurityService.class);
isAdmin = service.isCurrentUserAdmin();
}
catch (ServiceException e)
{
System.out.println("Exception occured: " + e);
return false;
}
return isAdmin;
}
}
Please Make sure your IAClasses.zip and services.jar are in the path before you create the your own custom jars for the above rule.
Kindly let me know if this works.
Thanks,
Madhav Pai
Please use this script i have tuned it up.
import com.installshield.wizard.service.ServiceException;
import com.installshield.wizard.service.security.SecurityService;
import com.zerog.ia.api.pub.CustomCodeRule;
public class AdminWizardBeanRule extends CustomCodeRule
{
public boolean evaluateRule()
{
boolean isAdmin = true;
try
{
SecurityService service = (SecurityService) ruleProxy.getService(SecurityService.class);
isAdmin = service.isCurrentUserAdmin();
}
catch (ServiceException e)
{
System.out.println("Exception occured: " + e);
return false;
}
return isAdmin;
}
}
Please Make sure your IAClasses.zip and services.jar are in the path before you create the your own custom jars for the above rule.
Kindly let me know if this works.
Thanks,
Madhav Pai
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 02, 2011
06:03 AM
Hi Madhav,
Its not working. Actually this is the script that I was using. I had added main to check the script. Its generating the NullPointerException in the line where we are creating the object og SecurityService. What I think its not creating the object of SecurityService (but it should because this is the only method to create the object of any service in CustomCodeRuleProxy mentioned in JavaDoc).
Anyways thanks alot for your support....
Its not working. Actually this is the script that I was using. I had added main to check the script. Its generating the NullPointerException in the line where we are creating the object og SecurityService. What I think its not creating the object of SecurityService (but it should because this is the only method to create the object of any service in CustomCodeRuleProxy mentioned in JavaDoc).
Anyways thanks alot for your support....
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 02, 2011
07:36 AM
The problem could be the ruleProxy is not referencing to CustomCodeRuleProxy object. When i printed ruleProxy, it was null. Can you suggest some solution.
Thanks
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 03, 2011
04:32 AM
Hi,
can anyone help me with the (above) issue. I am using the evaluation version and this problem has killed alot of my valuable time (21 days).
Thanks
can anyone help me with the (above) issue. I am using the evaluation version and this problem has killed alot of my valuable time (21 days).
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 06, 2011
02:12 AM
Hi atulmaurya,
Install Anywhere 2011 is available. I Request you to evaluate the latest Version and Check the Configuration your currently trying out in Install Anywhere 2010 Evaluation.
Please Try out the following link
http://www.flexerasoftware.com/resources/trials.htm#installanywhere
Thanks,
Madhav Pai
Install Anywhere 2011 is available. I Request you to evaluate the latest Version and Check the Configuration your currently trying out in Install Anywhere 2010 Evaluation.
Please Try out the following link
http://www.flexerasoftware.com/resources/trials.htm#installanywhere
Thanks,
Madhav Pai