Wednesday 09 March 2005 12:31:59 am
Hi! I have made a patch for login based on IP. This is made for only one user, but you get the idea of how to do it. This patch gets the IPaddress and the corresponding user from the site.ini.append.php file. (Patch is for 3.5.1)
--- ezpublish_releases/ezpublish-3.5.1/pre_check.php 2005-02-24 12:05:54.000000000 +0100
+++ precheck_fixedfor351.php 2005-03-09 09:26:30.999605632 +0100
@@ -89,6 +89,19 @@
// $uri =& $GLOBALS['eZRequestedURI'];
$check = array( "module" => "user",
"function" => "login" );
+
+ //---LoginOnIP-HACK
+ if ( $ini->hasVariable( 'LoginOnIP', 'IPAddress' ) && $ini->hasVariable( 'LoginOnIP', 'UserID' )
+ && $_SERVER['REMOTE_ADDR'] == $ini->variable( 'LoginOnIP', 'IPAddress' ) )
+ {
+ include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' );
+
+ $userID = ( int ) $ini->variable( 'LoginOnIP', 'UserID' );
+ $user = eZUser::fetch( $userID );
+ eZUser::setCurrentlyLoggedInUser( $user, $userID );
+ }
+ //---LoginOnIP-HACK
+
if ( $http->hasSessionVariable( "eZUserLoggedInID" ) and
$http->sessionVariable( "eZUserLoggedInID" ) != '' and
$http->sessionVariable( "eZUserLoggedInID" ) != $ini->variable( 'UserSettings', 'AnonymousUserID' ) )
@@ -173,4 +186,4 @@
}
It is _not_ recommended to change the kernel, because upgrades will be much harder. But if you really want to do it, this is how.
Kristian
http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute
|