1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-03-14 17:57:39 +00:00

nerf invalidate perm

This commit is contained in:
quark 2025-03-09 17:01:57 +01:00
parent 423454ba5d
commit a0ebf8658d
3 changed files with 8 additions and 4 deletions

View File

@ -1,7 +1,7 @@
# Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from datetime import date
from datetime import date, timedelta
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
@ -106,6 +106,7 @@ class PermissionBackend(ModelBackend):
Q=Q,
now=timezone.now(),
today=date.today(),
week=timedelta(days=7),
)
yield permission

View File

@ -2607,7 +2607,8 @@
"note",
"transaction"
],
"query": "[\"OR\", [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}], [\"NOT\", {\"recurrenttransaction__template__category__name\":\"Alcool\"}]], [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 0]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}], {\"recurrenttransaction__template__category__name\":\"Alcool\"}]]",
"query": "[\"AND\", [\"OR\", [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}], [\"NOT\", {\"recurrenttransaction__template__category__name\": \"Alcool\"}]], [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 0]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}], {\"recurrenttransaction__template__category__name\": \"Alcool\"}]], {\"created_at__gte\": {\"F\": [\"SUB\", [\"now\"], [\"week\"]]}}]"
,
"type": "change",
"mask": 2,
"field": "valid",
@ -2623,7 +2624,8 @@
"note",
"transaction"
],
"query": "[\"OR\", [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}], [\"NOT\", {\"recurrenttransaction__template__category__name\":\"Alcool\"}]], [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 0]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}], {\"recurrenttransaction__template__category__name\":\"Alcool\"}]]",
"query": "[\"AND\", [\"OR\", [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}], [\"NOT\", {\"recurrenttransaction__template__category__name\": \"Alcool\"}]], [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 0]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}], {\"recurrenttransaction__template__category__name\": \"Alcool\"}]], {\"created_at__gte\": {\"F\": [\"SUB\", [\"now\"], [\"week\"]]}}]"
,
"type": "change",
"mask": 2,
"field": "invalidity_reason",

View File

@ -1,7 +1,7 @@
# Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from datetime import date
from datetime import date, timedelta
from json.decoder import JSONDecodeError
from django.contrib.auth.models import User
@ -73,6 +73,7 @@ class PermissionQueryTestCase(TestCase):
Q=Q,
now=timezone.now(),
today=date.today(),
week=timedelta(days=7),
)
instanced.update_query()
query = instanced.query