Restrict User Group by IP

For Joomla! 2.5 Coding related discussions, please use:
Note: All 1.6, 1.7 and 3.5 releases have reached end of life and should be updated to 3.x.

Moderator: ooffick

Forum rules
Please use the mailing list here: rather than this forum.
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Jul 17, 2013 4:50 pm

Restrict User Group by IP

Post by adamtbigr » Wed Jul 17, 2013 5:00 pm

What I am trying to do is restrict a user group so they are only able to login to my joomla website if they are only in the office building.

The situation is we have built a Intranet website and we allow Site Admins, Managers, and Store Managers to access the website anywhere at any time, but hourly employees we want to restrict them to only being able to login the website if they withing our network, meaning they are not able to login to the website if they are anywhere else.

Is there any extension that offers this?

Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Tue Jan 05, 2010 9:34 am
Location: United Kingdom

Re: Restrict User Group by IP

Post by speru » Fri Oct 13, 2017 11:56 am

Although not a direct answer to the specific question of restricting log in to a usergroup by IP address, I would highly recommend that you look at Regular Labs Advanced Module Manager ... e-manager/ or their Conditional Content component.
I use this extensively for complex access requirements as you are able to restrict access by multiple criteria including IP address and usergroup.
By giving thought to what you want viewers within the internal network to see, and preventing that from being viewed from outside the network, the idea of restricting the actual log-on becomes a somewhat secondary consideration.
Last edited by imanickam on Fri Oct 13, 2017 12:24 pm, edited 1 time in total.
Reason: Per the forum rules, changed the URL of the extension from the developers URL to the JED URL

User avatar
Joomla! Explorer
Joomla! Explorer
Posts: 469
Joined: Wed Jul 30, 2008 4:40 am
Location: SC USA

Re: Restrict User Group by IP

Post by wwhite » Fri Oct 13, 2017 12:58 pm

but hourly employees we want to restrict them to only being able to login the website if they withing our network
It seems that you want to interfer with the abilility to log into the site.
Can you override the login and do the checks and redirects there after testing the ip with code similar to this

Code: Select all

$ip = JFactory::getApplication()->input->server->get('REMOTE_ADDR','');

Code: Select all

$user   = JFactory::getUser();
$levels = JAccess::getAuthorisedViewLevels($user->id);
and redirect the user to a restricted or error page if they dont pass all the tests?
Joomla - K2
Funeral Director - Every Day Above Ground is a Good Day!
Saying - This old world keeps spinning round, it a wonder tall trees aint laying down https://www.[youtube].com/watch?v=c_W9aaQ1Apo

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26936
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: Restrict User Group by IP

Post by Per Yngve Berg » Fri Oct 13, 2017 4:29 pm

Do the checks in an Authentication Plugin. ... for_Joomla



Return to “Joomla! 2.5 Coding”