====== User Pages ====== This is to have a namespace that is for user pages, where each user has AUTH_EDIT on their own page, without the need to add an entry for every user to the ACL. This patch has been applied after the [[:tips:Separate Admin Login]] patch: --- auth.php.bak 2009-02-24 15:29:16.000000000 +0000 +++ auth.php 2009-02-24 15:42:49.000000000 +0000 @@ -430,6 +430,13 @@ $max = AUTH_ADMIN; if($_SESSION[DOKU_COOKIE]['auth']['admin'] == true) { $max = AUTH_READ; } + //if users home page, minimum is AUTH_EDIT (but max above beats min here) + $min = AUTH_NONE; + $fullname = $_SESSION[DOKU_COOKIE]['auth']['info']['name']; + $fullname = str_replace(' ', '_', $fullname); + $fullname = strtolower($fullname); + if($id == 'users:'.$fullname) { $min = AUTH_EDIT; } + //make sure groups is an array if(!is_array($groups)) $groups = array(); @@ -471,7 +478,7 @@ } if($perm > -1){ //we had a match - return it - return min($perm,$max); + return min(max($perm,$min),$max); } } @@ -494,7 +501,7 @@ } } //we had a match - return it - return min($perm,$max); + return min(max($perm,$min),$max); } //get next higher namespace This is a hand-hacked version that doesn't require the other tip to be applied (you may have to fix it up): --- auth.php.bak 2009-02-24 15:29:16.000000000 +0000 +++ auth.php 2009-02-24 15:42:49.000000000 +0000 @@ -430,6 +430,13 @@ // if no ACL is used always return upload rights if(!$conf['useacl']) return AUTH_UPLOAD; + //if users home page, minimum is AUTH_EDIT (but max above beats min here) + $min = AUTH_NONE; + $fullname = $_SESSION[DOKU_COOKIE]['auth']['info']['name']; + $fullname = str_replace(' ', '_', $fullname); + $fullname = strtolower($fullname); + if($id == 'users:'.$fullname) { $min = AUTH_EDIT; } + //make sure groups is an array if(!is_array($groups)) $groups = array(); @@ -471,7 +478,7 @@ } if($perm > -1){ //we had a match - return it - return $perm; + return max($perm,$min); } } @@ -494,7 +501,7 @@ } } //we had a match - return it - return $perm; + return max($perm,$min); } //get next higher namespace If you want the users to create their own user page you must change the AUTH_EDIT on the line if($id == 'users:'.$fullname) { $min = AUTH_EDIT; } to AUTH_CREATE, like: if($id == 'users:'.$fullname) { $min = AUTH_CREATE; } This other version use the user login name instead the user name, and also grants create permission for the owner user. --- auth.php.orig 2009-02-14 04:13:25.000000000 -0800 +++ auth.php 2009-11-13 09:42:21.000000000 -0800 @@ -415,6 +415,13 @@ // if no ACL is used always return upload rights if(!$conf['useacl']) return AUTH_UPLOAD; + //if users home page, minimum is AUTH_CREATE (but max above beats min here) + if($id == 'users:'.$user) { + $min = AUTH_CREATE; + } else { + $min = AUTH_NONE; + } + //make sure groups is an array if(!is_array($groups)) $groups = array(); @@ -456,7 +463,7 @@ } if($perm > -1){ //we had a match - return it - return $perm; + return max($perm,$min); } } @@ -479,7 +486,7 @@ } } //we had a match - return it - return $perm; + return max($perm,$min); } //get next higher namespace