'Returns list of ``codename``\'s of all permissions for given ``obj``.'

def get_perms(self, user_obj, obj):

    from cms.test_utils.project.objectpermissionsapp.models import UserObjectPermission
    ctype = ContentType.objects.get_for_model(obj)
    related_name = UserObjectPermission.permission.field.related_query_name()
    user_filters = {('%s__user' % related_name): user_obj, ('%s__content_type' % related_name): ctype, ('%s__object_pk' % related_name): obj.pk}
    return Permission.objects.filter(content_type=ctype).filter(**user_filters).values_list('codename', flat=True)
