OAuth scope inside doctype

Hello.
How can I get user oauth scope in the custom doctype controller?
I need to implement doctype access permissions based on organisation units which comes in the oauth scope.
Thank you

1 Like

The oauth scope I can’t help with but you probably want to implement a custom has_permission function on your doctype to check.

Alternatively, you could try to sync the users and organizational units with a service account and apply that inside ERPNext via roles which would likely be much more performant than calling the oauth API for each document.