Install permissions

Hi,

I want to restrict non-admin users to be able to install (or run) my application. Is there a way to restrict this before distributing the app to the users?

Greetings,

Stadsman

Few different methods here are two though…

-- This method presents the user with a system generated authentication
-- dialog to prove they are an administrator

try
	do shell script "" with administrator privileges
	-- If they enter an admin user:pass correctly this portion runs
on error
	-- If they cancel out of the dialog or enter an inccorect user:pass
	-- 3 times this portion runs.
end try
-- This method checks the current users groups.  User is not required
-- to prove who they are.

if (do shell script "groups") contains "admin" then
	-- current logged in user is a member of the admin group
end if

Hi Stadsman,

I accidentally found a way to determine quite easy, whether the current user has admin status.
On admin users desktop as string in Finder returns the whole path starting with the root directory,
on non admin users the path starts with the user name


if not AdminUser() then return -- abort the script
-- go on  

on AdminUser()
	set {TID, text item delimiters} to {text item delimiters, ":"}
	tell application "Finder" to desktop as string
	set a to (count text items of result) = 5
	set text item delimiters to TID
	return a
end AdminUser

Great! Thanks to both of you. I’ll play around with them and see which suits best :smiley: