Bug 33261 - Installer should check for administrative rights
Summary: Installer should check for administrative rights
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Native:Packaging (show other bugs)
Version: 5.5.4
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-27 03:48 UTC by Luci Sandor
Modified: 2005-08-02 12:12 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luci Sandor 2005-01-27 03:48:29 UTC
Users might try to install Tomcat as a service although they migt not have this
right. The installer should check for admin rights and, if not admin, allow him
to install only as a console application.
Inspired by http://issues.apache.org/bugzilla/show_bug.cgi?id=32361
Comment 1 Yoav Shapira 2005-08-02 16:01:34 UTC
I suppose this a good excuse for me to learn more about NSIS ;)  First, the FAQ
at
http://nsis.sourceforge.net/wiki/How_can_I_make_sure_the_user_installing_my_software_has_admin_rights
says to go look at the UserInfo example that ships with NSIS.  Let me go look
and see.. ;)

I don't think I'll stop the installation, but maybe print out a big warning message.
Comment 2 Yoav Shapira 2005-08-02 16:09:33 UTC
The example that ships with NSIS does this:

Name "UserInfo.dll test"
OutFile UserInfo.exe

Section
	ClearErrors
	UserInfo::GetName
	IfErrors Win9x
	Pop $0
	UserInfo::GetAccountType
	Pop $1
	StrCmp $1 "Admin" 0 +3
		MessageBox MB_OK 'User "$0" is in the Administrators group'
		Goto done
	StrCmp $1 "Power" 0 +3
		MessageBox MB_OK 'User "$0" is in the Power Users group'
		Goto done
	StrCmp $1 "User" 0 +3
		MessageBox MB_OK 'User "$0" is just a regular user'
		Goto done
	StrCmp $1 "Guest" 0 +3
		MessageBox MB_OK 'User "$0" is a guest'
		Goto done
	MessageBox MB_OK "Unknown error"
	Goto done

	Win9x:
		# This one means you don't need to care about admin or
		# not admin because Windows 9x doesn't either
		MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"

	done:
SectionEnd
Comment 3 Yoav Shapira 2005-08-02 20:12:40 UTC
Done, committing now.  Please test it when you get a chance.

Note that I chose to not stop the installation: I think that's too severe a
move.  Instead, the installer will warn and explain what you were saying above
to non-admin users.