def METHOD_NAME(self, user_groups, flat=False):
    """ 获取用户组的授权规则 """
    if isinstance(user_groups, list):
        group_ids = [g.id for g in user_groups]
    else:
        group_ids = user_groups.values_list('id', flat=True).distinct()
    perm_ids = AssetPermission.user_groups.through.objects \
        .filter(usergroup_id__in=group_ids) \
        .values_list('assetpermission_id', flat=True).distinct()
    perms = self.get_permissions(ids=perm_ids)
    if flat:
        return perms.values_list('id', flat=True)
    return perms