'Returns list of ``codename``\'s of all permissions for given ``obj``.
:param obj: Django model instance for which permission should be checked'

def get_perms(self, obj):

    if (self.user and (not self.user.is_active)):
        return []
    ctype = get_content_type(obj)
    key = self.get_local_cache_key(obj)
    if (key not in self._obj_perms_cache):
        if (self.user and self.user.is_superuser):
            perms = list(chain(*Permission.objects.filter(content_type=ctype).values_list(u'codename')))
        elif self.user:
            user_perms = self.get_user_perms(obj)
            group_perms = self.get_group_perms(obj)
            perms = list(set(chain(user_perms, group_perms)))
        else:
            group_filters = self.get_group_filters(obj)
            perms = list(set(chain(*Permission.objects.filter(content_type=ctype).filter(**group_filters).values_list(u'codename'))))
        self._obj_perms_cache[key] = perms
    return self._obj_perms_cache[key]
