{"action":"created","issue":{"url":"https://api.github.com/repos/owncloud/impersonate/issues/5","labels_url":"https://api.github.com/repos/owncloud/impersonate/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/owncloud/impersonate/issues/5/comments","events_url":"https://api.github.com/repos/owncloud/impersonate/issues/5/events","html_url":"https://github.com/owncloud/impersonate/issues/5","id":115485640,"number":5,"title":"Doesn't work with LDAP users.","user":{"login":"Zappatron","id":10867924,"avatar_url":"https://avatars.githubusercontent.com/u/10867924?v=3","gravatar_id":"","url":"https://api.github.com/users/Zappatron","html_url":"https://github.com/Zappatron","followers_url":"https://api.github.com/users/Zappatron/followers","following_url":"https://api.github.com/users/Zappatron/following{/other_user}","gists_url":"https://api.github.com/users/Zappatron/gists{/gist_id}","starred_url":"https://api.github.com/users/Zappatron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zappatron/subscriptions","organizations_url":"https://api.github.com/users/Zappatron/orgs","repos_url":"https://api.github.com/users/Zappatron/repos","events_url":"https://api.github.com/users/Zappatron/events{/privacy}","received_events_url":"https://api.github.com/users/Zappatron/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-06T11:13:43Z","updated_at":"2015-11-25T04:32:17Z","closed_at":null,"body":"Impersonate doesn't work here (8.1.3) with LDAP users, using the guid or LDAP user name.\r\n\r\nThis would be a very useful feature!\r\n\r\nCheers\r\n"},"comment":{"url":"https://api.github.com/repos/owncloud/impersonate/issues/comments/159489176","html_url":"https://github.com/owncloud/impersonate/issues/5#issuecomment-159489176","issue_url":"https://api.github.com/repos/owncloud/impersonate/issues/5","id":159489176,"user":{"login":"scolebrook","id":6951720,"avatar_url":"https://avatars.githubusercontent.com/u/6951720?v=3","gravatar_id":"","url":"https://api.github.com/users/scolebrook","html_url":"https://github.com/scolebrook","followers_url":"https://api.github.com/users/scolebrook/followers","following_url":"https://api.github.com/users/scolebrook/following{/other_user}","gists_url":"https://api.github.com/users/scolebrook/gists{/gist_id}","starred_url":"https://api.github.com/users/scolebrook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scolebrook/subscriptions","organizations_url":"https://api.github.com/users/scolebrook/orgs","repos_url":"https://api.github.com/users/scolebrook/repos","events_url":"https://api.github.com/users/scolebrook/events{/privacy}","received_events_url":"https://api.github.com/users/scolebrook/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T04:32:17Z","updated_at":"2015-11-25T04:32:17Z","body":"Here's my version. Tried to do a branch and PR but discovered I'm not a contributor on this repo.\r\n\r\n```php\r\n\tpublic function impersonate($userid) {\r\n\t\tif ($this->userManager->userExists($userid)) {\r\n\t\t\t//$userid is an internal user id\r\n\t\t\t$newuser = $this->userManager->get($userid);\r\n\t\t} else {\r\n\t\t\t//$userid is any other search string\r\n\t\t\t$users = $this->userManager->search($userid, 1, 0);\r\n\t\t\tif (count($users) > 0 ) {\r\n\t\t\t\t$newuser = array_shift($users);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif (!empty($newuser)) {\r\n\t\t\t//we found something\r\n\t\t\t$this->userSession->setUser($newuser);\r\n\t\t}\r\n\t\t\r\n\t\treturn new JSONResponse();\r\n\t}\r\n```\r\n\r\nThis allows searching by internal uid which might be a username for an internal user, objectguid for an ad user, etc. It also searches for any attribute that the user manager can search. In the case of ldap users, that's all the search attributes that are configured on the admin page. Want to search for displayName? Add it to the search attributes list. Want to search for email address, userPrincipalName, samAccountName, etc? Add them to the list. Anything that can be used to search for users for sharing will work here. The difference is that this will go with the first match rather than give you a choice. So be specific.\r\n\r\nOnly problem is that it can't search for a display name containing a space. Neither can searching for sharing. I think that's a limitation in user_ldap. If that gets resolved, then this would work with spaces too automajically."}}