Hi there,
this is pretty straightforward as it goes so...
1 - Go to your form's php script that runs on load
2 - Insert the following line of code
// ================== BEGIN CHECK USERGROUP SCRIPT =================== //
// get current user from session
$user =& JFactory::getUser();
3 - Now choose which type of users you want to allow. For instance,
Do you want Superadmins & administrators OR
ONLY Superadmins have access to your form?
NOTE:
Below are 2 examples demonstrating each of these;
A) Superadmins ONLY

Superadmins & Administrators
Feel free to use them straight off. You need only replace the URL in the header redirect to the location you want to send unwanted users.
// ======= EXAMPLE A - SUPERADMINS ONLY ==========//
// if current logged in user isn't super admin
if(!$user->usertype == "Super Administrator"){
// redirect
header('Location:whatever_url/directory/_or_/page/you_want_to/redirect_to'); // ** CHANGE URL ** //Full or Relative path OK with or without index (if its reachable)
die(); // just to make sure, kill the script
}else{
// otherwise, load the form
return true;
}
// ================= END EXAMPLE A ===============//
// ===== EXAMPLE B - ALL ADMINS & SUPERADMINS ====//
// if current logged in user isn't super admin or administrator
if(!$user->usertype == "Super Administrator" || !$user->usertype == "Administrator"){
header('Location:whatever_url/directory/_or_/page/you_want_to/redirect_to'); // Full or Relative path OK with or without index (if its reachable)
die(); // just to make sure, kill the script
}else{
// user is an admin or superadmin so load the form
return true;
}
// ================= END EXAMPLE B ===============//
Alternatively, you could adapt either example to incorporate any of the Joomla Usergroups, switch to allow all but a specific group/groups, CommunityBuilder or custom fields. This could be achieved by executing a short SQL query to get further info related to the user.
Once you have the parameters you wish to check from the database result(s) stored as $variable(s) you can introduce them into the IF/ELSE statement(s) accordingly. Then you can evaluate any combination of conditions to be true/false to further granualise access to suit your requirements.
You would do this using AND (&&), OR (||) comparison operators in any checks. There are a few scenarios in which you might want to extend my working examples that I've highlighted below.
OK, so once you've decided how you want to check the user's permissions...
As mentioned, you could further extend the parameters with which you evaluate to determine a user's access to your form. Here are a few examples on situations in which you might do so;
1 - You want to give access to the form based on user being either a superadmin OR administrator OR a registered user with author privileges in a specific section/category
2 - You want to give access to the form based on user being either a superadmin OR registered and subscribed to a particular membership/account (CB/Ambra/Docman or any component)
3 - You want to give access to the form based on the current date, time, or even a unique registration code
Thanks to the RSgeniuses, the component is awesomely-flexible and can do whatever you want, limited only by your imagination
One last thing that I think may be of use to you is that, instead of redirecting the user, you could hide certain parts of the form using the string replace function.
It's pretty straight forward...
There are 3 parameters
1 - The string you want to replace - should be in 'single' quotes
2 - Your new string (could be empty to delete what you searched for '')
3 - The text in which you want to operate
In the code below, you can see that the function str_replace has been parametised as described above, where
1 - String to replace is 'what you want to replace'
2 - New string is 'replace with this instead'
3 - The text we want to search and replace in is the $formLayout variable. This is where all of the table or div elements that comprise your form are held. You could use this to hide/disable a field completely for particular user types.
Once you've located the table/div ids from the source code of your form (right-click & select, 'view source' on your frontend-form), simply swap the strings you want to replace/replace with to utilise
$formLayout = str_replace('what you want to replace','replace with this instead',$formLayout);
Hope this is useful...
Best wishes,
Gez