{"action":"created","issue":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/issues/2135","repository_url":"https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle","labels_url":"https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/issues/2135/labels{/name}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/issues/2135/comments","events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/issues/2135/events","html_url":"https://github.com/FriendsOfSymfony/FOSUserBundle/issues/2135","id":155730607,"number":2135,"title":"Default role in Model/User","user":{"login":"lk77","id":9606882,"avatar_url":"https://avatars.githubusercontent.com/u/9606882?v=3","gravatar_id":"","url":"https://api.github.com/users/lk77","html_url":"https://github.com/lk77","followers_url":"https://api.github.com/users/lk77/followers","following_url":"https://api.github.com/users/lk77/following{/other_user}","gists_url":"https://api.github.com/users/lk77/gists{/gist_id}","starred_url":"https://api.github.com/users/lk77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lk77/subscriptions","organizations_url":"https://api.github.com/users/lk77/orgs","repos_url":"https://api.github.com/users/lk77/repos","events_url":"https://api.github.com/users/lk77/events{/privacy}","received_events_url":"https://api.github.com/users/lk77/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-19T12:59:40Z","updated_at":"2016-05-19T13:11:58Z","closed_at":null,"body":"Hello,\r\nthere is a default role in the Abstract User class, in function getRoles():\r\n\r\n\r\n```\r\n// we need to make sure to have at least one role\r\n$roles[] = static::ROLE_DEFAULT;\r\n```\r\n\r\n\r\n\r\ni think is better to do:\r\n\r\n\r\n```\r\nif (empty($roles)) {\r\n            // we need to make sure to have at least one role\r\n            $roles[] = static::ROLE_DEFAULT;\r\n}\r\n```\r\n\r\nthe purpose is to avoid to have an extra role.\r\n"},"comment":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/issues/comments/220319532","html_url":"https://github.com/FriendsOfSymfony/FOSUserBundle/issues/2135#issuecomment-220319532","issue_url":"https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/issues/2135","id":220319532,"user":{"login":"stof","id":439401,"avatar_url":"https://avatars.githubusercontent.com/u/439401?v=3","gravatar_id":"","url":"https://api.github.com/users/stof","html_url":"https://github.com/stof","followers_url":"https://api.github.com/users/stof/followers","following_url":"https://api.github.com/users/stof/following{/other_user}","gists_url":"https://api.github.com/users/stof/gists{/gist_id}","starred_url":"https://api.github.com/users/stof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stof/subscriptions","organizations_url":"https://api.github.com/users/stof/orgs","repos_url":"https://api.github.com/users/stof/repos","events_url":"https://api.github.com/users/stof/events{/privacy}","received_events_url":"https://api.github.com/users/stof/received_events","type":"User","site_admin":false},"created_at":"2016-05-19T13:11:58Z","updated_at":"2016-05-19T13:11:58Z","body":"This was already suggested in the past, and rejected.\r\nAdding the default role only when the user does not have any other role would lead to WTF from the user, where adding a role to a user could magically remove access to another section which relied on the default role for that. It is much easier to understand that this role is always there"}}