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
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...)
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>";
}
//----------------------------------------------------------------------------------------
you are using $my... I suggest you stick to the joomla permission system, in this case...
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.
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
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.
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.