Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problema di permessi su alcune operazioni sugli ordini fatte dai referenti del Patto relativo #204

Open
matteo88 opened this issue Oct 24, 2015 · 2 comments

Comments

@matteo88
Copy link
Contributor

Se un Patto ha più referenti e uno di questi apre un ordine, gli altri referenti non possono decurtare i membri del GAS che hanno ordinato nè registrare la fattura dell'ordine.

@matteo88
Copy link
Contributor Author

A livello di codice, il problema ricade in questa riga:

if not self.__loggedusr.has_perm(CASH, obj=ObjectWithContext(self.__order.gas)) and \
    not self.__loggedusr == self.__order.referrer_person.user:
        raise PermissionDenied(ugettext("You are not a cash_referrer or the order's referrer, you cannot update GASMembers cash!"))

in particolare, il controllo

not self.__loggedusr == self.__order.referrer_person.user:

vuole indicare che solo il referente che ha aperto l'ordine può eseguire le relative operazioni su di esso.

In realtà, questa è una svista perchè in un Patto potrebbero esserci più referenti che in simbiosi dovrebbero poter gestire le operazioni, ad esempio uno di essi apre l'ordine ed un altro esegue le operazioni di registrazione e decurtazioni. Questo è utile soprattutto su ordini più complessi che necessitano un impegno temporale ed organizzativo non indifferente, che dovrebbe essere diviso tra più persone. Inoltre è utile anche per favorire un'ottica di coinvolgimento tra i soci del GAS che sono anche referenti (o che potrebbero diventarlo).

La soluzione a questo problema consiste nel modificare il codice (ove necessario) in modo che a tutti i referenti del Patto siano concessi i permessi per modificare gli ordini, quindi da:

if not self.__loggedusr.has_perm(CASH, obj=ObjectWithContext(self.__order.gas)) and \
    not self.__loggedusr == self.__order.referrer_person.user:
        raise PermissionDenied(ugettext("You are not a cash_referrer or the order's referrer, you cannot update GASMembers cash!"))

a

if not self.__loggedusr.has_perm(CASH, obj=ObjectWithContext(self.__order.gas)) and \
    not self.__loggedusr == self.__order.referrers:
        raise PermissionDenied(ugettext("You are not a cash_referrer or the order's referrer, you cannot update GASMembers cash!"))

@feroda
Copy link
Contributor

feroda commented Oct 24, 2015

@matteo88 In specifications there are referrers for deliveries, but I agree that should be easier to allow every pact referrer to curtail gasmembers of related orders.

Imho It should be done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants