Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: External access token expiration

by
Camptocamp SA, Akim Juillerat
- 12/01/2024 17:52:21
Thanks Holger for your answer.

I'm not sure it would work in our case if said e-mail has to be sent multiple times, but it's an interesting technique I'll try to keep in mind for a later use.

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Akim Juillerat
Business solutions
Software architect
+41 62 544 03 78

Camptocamp SA
Leberngasse 21
4600 Olten
Switzerland
+41 21 619 10 10


On Thu, Jan 11, 2024 at 9:52 PM Holger Brunn <notifications@odoo-community.org> wrote:
> Did anyone here face a similar requirement? How did you handle it?


> Ideally, we would need a single token to be generated per e-mail being sent


> so that we can define the expiration of said token, but it seems like


> there's no other solution than to overwrite and redefine everything, what I


> would prefer to avoid to ease maintenance of such a module. Thanks for


> sharing your insights.

are you aware of the poisoning the cache technique?

you can do things like

def _notify_get_groups(self, msg_vals=None):
     self._cache['access_token'] = 'whatever you need for your workflow'
     return super()._notify_get_groups(msg_vals=msg_vals)

and given super won't initiate a new database read, it will stick with 
whatever you put in the cache, as that's where the ORM reads values from first.

I read through your whole thing because I'm a weird kind of nerd, for other 
people to read it I suggest to start with a TLDR on the beginning so that 
people can filter if they're interested or not.



-- 
Your partner for the hard Odoo problems
https://hunki-enterprises.com

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

Reference