title: Django permission belongs to group, but user on that group has no group's permission
body: <p>I decided to not use <code>django-guardian</code> because If my customer delete/create <code>Group</code> I have to add more overhead on my <code>ModelManager</code> to transfer the existing permissions to new group. Therefore let the instances got filtered by <code>filter_queryset</code> through Django REST is fine for my case.</p>
  
  <p><strong>FailedTestCase:</strong></p>
  
  <pre><code>from django.contrib.auth.models import User
  
  from poinkbackend.apps.companies.models import Company
  from poinkbackend.apps.roles.models import Role
  from poinkbackend.apps.userroles.models import UserRole
  from poinkbackend.apps.commons.tests import companies, userprofiles, branches
  
  def test_support_view_userprofile(companies, userprofiles):
      company = Company.objects.get(name='Singh')
      support = Role.objects.add_support('firstsupport', company)
      user = User.objects.get(username='notty')
      UserRole.objects.create(user=user, role=support)
      user.refresh_from_db()
      import pdb; pdb.set_trace()
      assert True is user.has_perm('view_userprofile')
  </code></pre>
  
  <blockquote>
  <pre><code>-&gt; assert True is user.has_perm('view_userprofile')
  (Pdb) user.groups.first()
  &lt;Group: firstsupport-Singh&gt;
  (Pdb) g1 = user.groups.first()
  (Pdb) g1.permissions.all()
  &lt;QuerySet [&lt;Permission: userprofiles | user profile | View UserProfile&gt;]&gt;
  (Pdb) user.has_perm('view_userprofile')
  False
  </code></pre>
  </blockquote>
  
  <p><strong>Question:</strong><br>
  Where am I wrong?</p>
  
  <p><strong>Update 16 Nov 2017 10:30 GMT+7 Add 4th url</strong>
  <strong>Gists:</strong><br>
  Company : <a href="https://gist.github.com/elcolie/684ba34391d0a94df7ca98855cea765b" rel="nofollow noreferrer">https://gist.github.com/elcolie/684ba34391d0a94df7ca98855cea765b</a><br>
  Role : <a href="https://gist.github.com/elcolie/64a3a3daf22240b2072e113eb10164e2" rel="nofollow noreferrer">https://gist.github.com/elcolie/64a3a3daf22240b2072e113eb10164e2</a><br>
  UserRole: <a href="https://gist.github.com/elcolie/d28e7fcf54334a9f13df5fff1b7d9fe0" rel="nofollow noreferrer">https://gist.github.com/elcolie/d28e7fcf54334a9f13df5fff1b7d9fe0</a><br>
  BusinessPermisson: <a href="https://gist.github.com/elcolie/bbeb00f41db0c7884cee34c6bccaf5f9" rel="nofollow noreferrer">https://gist.github.com/elcolie/bbeb00f41db0c7884cee34c6bccaf5f9</a><br></p>
  
  <p><strong>References:</strong><br>
  <a href="https://stackoverflow.com/questions/43106704/django-user-has-perm-returning-false-even-though-group-has-permission">Django user has_perm returning false even though group has permission</a><br>
  <a href="https://stackoverflow.com/questions/23757901/django-user-not-getting-the-assigned-groups-permissions">Django user not getting the assigned group&#39;s permissions</a><br>
  <a href="https://stackoverflow.com/questions/16474235/django-group-permission">django group permission</a><br></p>