{"action":"created","issue":{"url":"https://api.github.com/repos/splitbrain/dokuwiki/issues/1561","repository_url":"https://api.github.com/repos/splitbrain/dokuwiki","labels_url":"https://api.github.com/repos/splitbrain/dokuwiki/issues/1561/labels{/name}","comments_url":"https://api.github.com/repos/splitbrain/dokuwiki/issues/1561/comments","events_url":"https://api.github.com/repos/splitbrain/dokuwiki/issues/1561/events","html_url":"https://github.com/splitbrain/dokuwiki/issues/1561","id":152790347,"number":1561,"title":"Respect showuseras everywhere","user":{"login":"ndarilek","id":1172,"avatar_url":"https://avatars.githubusercontent.com/u/1172?v=3","gravatar_id":"","url":"https://api.github.com/users/ndarilek","html_url":"https://github.com/ndarilek","followers_url":"https://api.github.com/users/ndarilek/followers","following_url":"https://api.github.com/users/ndarilek/following{/other_user}","gists_url":"https://api.github.com/users/ndarilek/gists{/gist_id}","starred_url":"https://api.github.com/users/ndarilek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndarilek/subscriptions","organizations_url":"https://api.github.com/users/ndarilek/orgs","repos_url":"https://api.github.com/users/ndarilek/repos","events_url":"https://api.github.com/users/ndarilek/events{/privacy}","received_events_url":"https://api.github.com/users/ndarilek/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-03T14:38:02Z","updated_at":"2016-05-03T18:42:52Z","closed_at":null,"body":"I'm the author of the DokuWiki [Sandstorm](https://sandstorm.io) port. Sandstorm makes administering servers as easy as working with apps on your phone. With my port, users can spin up secure, shareable wiki instances in a single click, and upgrade them just as easily.\r\n\r\nSandstorm acts as an HTTP proxy between users and apps. It handles authentication, and passes usernames/handles to the app via HTTP headers. In Sandstorm, the thing that is most like a Unix username is a non-user-friendly hash. Users can have their own preferred display names, but these aren't guaranteed to be unique and can change any time the user wants them to. That's not usually a big deal since most Sandstorm apps are used for smaller groups (I.e. I could easily spin up half a dozen wikis for a group and share them with a handful of users, so the likelihood of display names clashing is usually low enough to not worry about.)\r\n\r\nSo I've set the following in local.php:\r\n\r\n```\r\n$conf['showuseras']  = 'username';\r\n```\r\n\r\nMy hope was that this would display the friendly, human-readable Sandstorm usernames everywhere. I've also written a custom auth plugin. Here is how I'm setting up the user:\r\n\r\n```\r\n    public function trustExternal($user, $pass, $sticky = true) {\r\n        global $USERINFO;\r\n        global $conf;\r\n        $sticky = true;\r\n        $USERINFO['name'] = rawurldecode($_SERVER['HTTP_X_SANDSTORM_USERNAME']);\r\n        $USERINFO['mail'] = 'user@example.com';\r\n        $USERINFO['grps'] = str_getcsv($_SERVER['HTTP_X_SANDSTORM_PERMISSIONS']);\r\n        $_SERVER['REMOTE_USER'] = $_SERVER['HTTP_X_SANDSTORM_USER_ID'];\r\n        $_SESSION[DOKU_COOKIE]['auth']['user'] = $USERINFO['name'];\r\n        $_SESSION[DOKU_COOKIE]['auth']['pass'] = $pass;\r\n        $_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO;\r\n        return true;\r\n    }\r\n```\r\n\r\nIn Sandstorm, X-Sandstorm-User-Id is the unique, hash, non-human-friendly userID while X-Sandstorm-Username is the human-friendly, non-unique name. I want user-id to be what Dokuwiki stores in whatever it needs to uniquely track users, while x-sandstorm-username is what is always, always, always shown to users. Granted, this makes it difficult to link to users, but most of the wikis I use don't rely on that feature anyway, and Sandstorm will eventually have autocomplete widgets that can detect when someone starts typing a Sandstorm username and replace it inline with whatever you want, so in this case wiki links to the ugly hashes.\r\n\r\nWith the above config snippet in place, I still get user hashes displayed just about everywhere. The username is displayed when showing what the user is logged in as, but it is followed immediately by the hash. Additionally, the recent changes page and information about who last edited a page is still displayed as a hash. I've made a few tweaks that eliminate some of these hashes, but instead they end up showing the logged-in user, so I'm probably pulling the incorrect data from some confusingly-named global or other. Seems like it'd be easier to get this config option to meet my expectations so I don't have to diverge the Sandstorm port much.\r\n\r\nI'd thought that showuseras would resolve this, but it seems selectively applied. What am I missing? Am I setting up my user incorrectly in my auth plugin? I'm not a PHP person and this code isn't exactly the easiest to jump into for someone who just wants to get Doku running in Sandstorm so he doesn't have to poke it anymore. :)\r\n\r\nThanks."},"comment":{"url":"https://api.github.com/repos/splitbrain/dokuwiki/issues/comments/216625772","html_url":"https://github.com/splitbrain/dokuwiki/issues/1561#issuecomment-216625772","issue_url":"https://api.github.com/repos/splitbrain/dokuwiki/issues/1561","id":216625772,"user":{"login":"ndarilek","id":1172,"avatar_url":"https://avatars.githubusercontent.com/u/1172?v=3","gravatar_id":"","url":"https://api.github.com/users/ndarilek","html_url":"https://github.com/ndarilek","followers_url":"https://api.github.com/users/ndarilek/followers","following_url":"https://api.github.com/users/ndarilek/following{/other_user}","gists_url":"https://api.github.com/users/ndarilek/gists{/gist_id}","starred_url":"https://api.github.com/users/ndarilek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndarilek/subscriptions","organizations_url":"https://api.github.com/users/ndarilek/orgs","repos_url":"https://api.github.com/users/ndarilek/repos","events_url":"https://api.github.com/users/ndarilek/events{/privacy}","received_events_url":"https://api.github.com/users/ndarilek/received_events","type":"User","site_admin":false},"created_at":"2016-05-03T18:42:52Z","updated_at":"2016-05-03T18:42:52Z","body":"Also, is it possible that I'm setting it incorrectly? I'm not entirely \nclear on Doku's terminology for unique login names vs. friendly display \nnames.\n"}}