Feature #22845
closedFeature Request to add priority on groupLogin
0%
Description
We have the current situation :
- we have different fe_groups, each corresponding to a set of pages in the website
- users may have more than one group
- their login page depdends on the group, but when a user has many groups, we would like to tell wich group login has priority.
However the processRedirect method of tx_felogin_pi1 will get the first groupLogin redirectPid depending on databse order for groups.
We have created a new extention that adds a 'login priority' column to group definitioins and provides a user class overriding the tx_felogin to take that priority in the query for groupLogin.
Not sure this was the best way to do it and as I hate the concept of user classes to extend the default typo3 ones, I woule be very greatful if you would take this change into consideration in the code.
I am no expert in typo3 but If you want I can upload a patch to do this.
Impacted fies are :
- ext_tables (to add the "felogin_redirectPriority' column)
- class.tx_felogin_pi1.php (to change the processRedirect method in order to add an order clause on the added column in the groupLogin query)
Regards,
Frédéric Leroy
(issue imported from #M14670)
Updated by LEROY about 14 years ago
Oups, had found issue 11870 similar to mine and intended to add a relationship but I don't have rights for this ! Sorry...
Updated by LEROY almost 14 years ago
Hi Navi,
If you wan't to achieve this, here is how we did it :
We created an extension (called bm_auth in our project) that :
1. extends the fe_groups table to add a "login priority" on group (we named id login_priotrity in kickstarter; thus column takes name tx_bmauth_login_priority in db)
2. create a class ux_tx_felogin_pi1 that extends the tx_felogin_pi1
3. add a "protected function processRedirect" method to that class (this will override the normal typo3 processing)
4. register this class in ext_localconf.php :
if (TYPO3_MODE=="FE") {
$TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/felogin/pi1/class.tx_felogin_pi1.php'] = PATH_typo3conf."ext/bm_auth/class.ux_tx_felogin_pi1.php";
}
The method in our class has the following code :
protected function processRedirect() {
$redirect_url=array();
if ($this->logintype === 'login') {
if ($this->conf['redirectMode']) {
$redirectMethods = t3lib_div::trimExplode(',', $this->conf['redirectMode'], TRUE);
if (in_array('groupLogin', $redirectMethods)) {
$redirModeBackup = $this->conf['redirectMode'];
foreach ($redirectMethods as $redirectMethod) {
$urlToAdd = array();
if ($redirectMethod == 'groupLogin') {
$feuser = $GLOBALS['TSFE']->fe_user;
$groupData = $feuser->groupData;
if ($groupData['uid']) {
$field = 'felogin_redirectPid';
$table = $GLOBALS['TSFE']->fe_user->usergroup_table;
$where = 'felogin_redirectPid!="" AND uid IN ('.implode(',', $groupData['uid']).')';
$order = 'tx_bmauth_login_priority';
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($field, $table, $where, '', $order);
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
$groupUrl = $this->pi_getPageLink($row[0], array(), TRUE); // take the first group with a redirect page
}
$urlToAdd[] = $groupUrl;
}
} else {
$this->conf['redirectMode'] = $redirectMethod;
$urlToAdd = parent::processRedirect();
}
if ($urlToAdd) {
foreach($urlToAdd as $url) {
$redirect_url[]=$url;
}
}
}
$this->conf['redirectMode']=$redirModeBackup;
} else {
$redirect_url = parent::processRedirect();
}
}
} else {
$redirect_url = parent::processRedirect();
}
return $redirect_url;
}
NOTE : this method is slighty different from ours as we override other stuff, i have not tested it but it should be close from working if not
This is not perfect situation : we end up calling the parent methd for all other redirect modes individually (not so good for performance).
Updated by Alexander Opitz about 11 years ago
- Status changed from New to Needs Feedback
- Target version deleted (
0) - TYPO3 Version set to 4.4
As this report is very old, is the handling in newer TYPO3 CMS Versions (like 6.0/6.1) more like you expect it?
Updated by Alexander Opitz almost 11 years ago
- Status changed from Needs Feedback to Closed
No response in over 3 month so closing this issue.
If you think this issue should be reopened, then write to the bugs mailing list.