php - Joomla ACL integration -
php - Joomla ACL integration -
does know of way integrate joomla acl, create users , log users in programatically within custom component's controller , modules.
i've scoured google either asking wrong questions, no 1 has documented how it, or it's not possible (which don't believe!)
why may ask?! - developing single sign on application component must log user several api's when sign in. unfortuanetly client wants work acl such can show command content on front end end of website based on if user logged in or not.
so need abole create own login view , when used, log user various systems using api's , log them (or create business relationship , log into) joomla acl.
you clone installed mod_login login portion of it, , utilize form of below code creating user account:
you can create user this:
require_once('registration.php'); jimport('joomla.user.helper'); jimport('joomla.application.component.modeladmin'); $data = array( 'username' => 'jdoe', 'name' => 'joan doe', 'email1' => jdoe@jdoe.com, 'password1' => 'abc123', // first password field 'password2' => 'abc123', // confirm password field 'block' => 0, 'params' => array( 'admin_style'=>'', 'admin_language'=>'', 'language'=>'', 'editor'=>'', 'helpsite'=>'', 'timezone'=>'' ) ); $model = new usersmodelregistration(); if(!$user = $model->register($data)) { echo $model->geterror(); }
you can login this:
$app = jfactory::getapplication('site'); $credentials = array( 'username' => 'someusername', 'password' => 'somepassword' ); if(!$app->login($credentials)){ echo 'logged in'; }else{ echo 'not logged in'; } $app->logout(); // log out $app->close(); // close app
to add together custom code login process, can write simple user authentication plugin. (see creating authentication plugin joomla) , set code in onauthenticate()
function.
to add together custom code after authentication, write user plugin (see plugin/events/user) , utilize 1 of events fire there.
i wasn't clear on acl values beingness stored, , got clarification question. it's category permissions, it's reply may help.
php joomla single-sign-on acl
Comments
Post a Comment