{"action":"opened","issue":{"url":"https://api.github.com/repos/Adldap2/Adldap2/issues/284","repository_url":"https://api.github.com/repos/Adldap2/Adldap2","labels_url":"https://api.github.com/repos/Adldap2/Adldap2/issues/284/labels{/name}","comments_url":"https://api.github.com/repos/Adldap2/Adldap2/issues/284/comments","events_url":"https://api.github.com/repos/Adldap2/Adldap2/issues/284/events","html_url":"https://github.com/Adldap2/Adldap2/issues/284","id":160629609,"number":284,"title":"getPrimaryGroup() does not work","user":{"login":"theliass","id":8260704,"avatar_url":"https://avatars.githubusercontent.com/u/8260704?v=3","gravatar_id":"","url":"https://api.github.com/users/theliass","html_url":"https://github.com/theliass","followers_url":"https://api.github.com/users/theliass/followers","following_url":"https://api.github.com/users/theliass/following{/other_user}","gists_url":"https://api.github.com/users/theliass/gists{/gist_id}","starred_url":"https://api.github.com/users/theliass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theliass/subscriptions","organizations_url":"https://api.github.com/users/theliass/orgs","repos_url":"https://api.github.com/users/theliass/repos","events_url":"https://api.github.com/users/theliass/events{/privacy}","received_events_url":"https://api.github.com/users/theliass/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-16T10:32:14Z","updated_at":"2016-06-16T10:32:14Z","closed_at":null,"body":"Hi!\r\nI need to get the Primary Group of a user, but it returns false everytime.\r\nI did a bit of debugging and I found out a possible cause in method getPrimaryGroup() in User.php.\r\n\r\nPrimary Group SID is generated from user SID, but in a wrong way!\r\n\r\nExample:\r\n__User SID__: S-1-5-21-1234567890-123456789-1234567890-20222\r\n__Prim. Grp SID__ (generated from user sid): S-1-5-21-1234567890-123456789-1234567890-2513\r\n__Real Primary Group ID__: 513\r\n\r\nI tried to modify class method like this:\r\n\r\n```php\r\npublic function getPrimaryGroup()\r\n{\r\n    $sid = $this->getSid();\r\n\r\n    $groupSid = explode(\"-\", $sid);\r\n    $groupSid[7] = $this->getPrimaryGroupId();\r\n    $groupSid = implode(\"-\", $groupSid);\r\n\r\n    return $this->query->findBySid($groupSid);\r\n}\r\n```\r\n\r\nAfter the modify, the Primary Group SID is now generated correctly, but it returns false anyway.\r\nWith LDAP browser using filter (objectSid=S-1-5-21-1234567890-123456789-1234567890-513) I get the group.\r\n\r\nAm I doing something wrong?\r\n\r\nConfigurations:\r\n```php\r\n$config->setDomainControllers('10.20.30.40');\r\n$config->setBaseDn('DC=contoso,DC=local');\r\n$config->setAdminUsername('admin');\r\n$config->setAdminPassword('password');\r\n$config->setAccountSuffix('@contoso.local');\r\n$config->setAdminAccountSuffix('@contoso.local');\r\n$config->setFollowReferrals(true);\r\n$config->setUseSSL(true);\r\n```"}}
{"actor":{"display_login":"theliass"}}