Skip to content

Commit

Permalink
adds code to redirect to group
Browse files Browse the repository at this point in the history
  • Loading branch information
turnermm committed Mar 21, 2019
1 parent 3748bb0 commit 4ed8a30
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion action.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,27 @@ function handle_act(Doku_Event $event, $param) {
}
$user = $_SERVER['REMOTE_USER'];
if(!$user) return;
$grps = $USERINFO['grps'];
$auto_login = $this->getConf('auto_login');
$redirect_target = "";
if($auto_login) {
$user_grps = $USERINFO['grps'];
$groups = $this->getConf('group');
$groups = preg_replace("/\s+/","",$groups);
$groups = explode(',',$groups);
$grp_opt = $this->getConf('group_options');
foreach($groups as $grp) {
if(in_array ($grp , $user_grps)) {
$redirect_target = "$grp:";
$redirect_target .= ($grp_opt == 'user_page' ? $user : $conf['start']);
break;
}
}
if($redirect_target) {
setcookie("GOTO_LOGIN", $redirect_target, time()+120, DOKU_BASE);
return;
}
}
//msg($redirect_target);

if($auto_login) {
$option = $this->getConf('auto_options');
Expand Down

0 comments on commit 4ed8a30

Please sign in to comment.