authentication-simple secure joomla-smf bridge

Started by mojito, January 27, 2006, 01:00:22 PM

Previous topic - Next topic

mojito

Good evening and haylo

I need to understand a little more about how the bridging process using the orsitio bridge (sorry if its not yours) works.

I have bridged my install and all is working (hooray) but am developing some custom components into joomla. I need to restrict access to pages now and run various if's e.g.

if (current user is the creator){
show an edit button
}

Can I use smf authentication? and how would i do that.

thanks

mojito
SMF 1.1 RC2 bridge 1.4

Kindred

how are you defining the creator in the first place?   By joomla id or by SMF id?

(if you're talking about a joomla module, chances are that you should probably use joomla's ID code...)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

mojito

This is the way I may do it with an include to the following code//----------------------------------------------------------------------------------------
global $mainframe,$my; # Ensure access to core functions
echo $my->usertype;
global $my,$database;
$sql = "SELECT username FROM info WHERE ID='".$_REQUEST['which']."'";
$database->setQuery( $sql);
$rows = $database->loadObjectList();
//set a creator flag
if ($rows[0]->username==$my->username) $creator=true else $creator=false;

$is_editor = (strtolower($my->usertype) == 'editor' || strtolower($my->usertype) == 'publisher' || strtolower($my->usertype) == 'manager' || strtolower($my->usertype) == 'administrator' || strtolower($my->usertype) == 'super administrator' );
$is_user   = (strtolower($my->usertype) <> '');
if($is_editor){
echo "<br>this is a recognised editor allow access<br>";
}
if (!$is_user) {
echo " <br />redirecting to register page as not registered user<br>";
}elseif(!$creator){

echo "<br /> you are registered but not the creator of this item<br>";
}
else{
echo "<BR>YOU CREATED THIS ITEM AND CAN EDIT IT!<BR>";
}
//----------------------------------------------------------------------------------------
SMF 1.1 RC2 bridge 1.4

Kindred

you are using $my...   I suggest you stick to the joomla permission system, in this case...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Orstio

Why does your component need to rely at all on the SMF permission system?

If I were you, I would make it work in Joomla, ignoring the SMF bridge.  The bridge doesn't change how the permissions work in Joomla.

mojito

Thanks for advice

what is $my from? if not joomla what should I be using?

Since I use the bridge I dont want any problems arrising because of that, im thinking that since I used the bridge everything is using smf for authentication? But it sounds like from your reply that is not the case.

thanks guys.

mojito
SMF 1.1 RC2 bridge 1.4

Kindred

the $my array is from joomla.

As it has been stated a number of times, the bridge does not really do ANYTHING to either SMF or Joomla except add a link between the logins. NONE of the database tables and NONE of the source files are modified.

There is currently no (and never has been any) relationship between the SMF permissions and the joomla permissions.

Authentication of a user's existance for login is accomplished at login by the bridge...   that's it.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Orstio

QuoteSince I use the bridge I dont want any problems arrising because of that, im thinking that since I used the bridge everything is using smf for authentication? But it sounds like from your reply that is not the case.

Joomla items use Joomla's authentication, just as if the bridge does not exist.

SMF and bridge-related items use SMF for authentication.

Do the components you are developing rely on the bridge whatsoever?  Do they need to pull information from SMF?  If not, then don't worry about SMF authentication.

Advertisement: