Workflow Query

Good afternoon, I'm hoping someone can please help me sort out my Workspace project flow:

1. The goal is to be able to share my project for others to use, but (a) to keep my code hidden or mostly private, and (b) validate users so that I can handle subscriptions.

2. The project involves a complex Sheets template and a number of scripts, including some that require restricted scopes.

3. Sharing format: My current plan is to use a standalone project and share that as a library.

4. For validation:

(a) The library has a service account which checks a Sheet, in a separate project for security purposes (set to Restricted and shared only with the service account), for the user's email and subscription status. This validation will occur on a timed trigger, and when the user opens the project (onOpen). The validation status is then cached.

(b) This is where the workflow gets a little shaky and I could use some help: When a user calls a library function, there's a gateway function which checks their status against the cache. That, or the gateway could run 4a, and then cache the status, and then all other functions would require a cache check.

In addition to that, I'm having trouble with context switching when the user calls the gateway; it's been difficult to force it to apply the user's information rather than the library's, e.g. if it's sending an email. This works fine if the user calls the library directly, but it seems to break down when I try to use a gateway function to handle user validation.

Lastly, I'm running into problems because of the restricted scopes (e.g. Gmail, Drive, Calendar). There are too many for me to manually separate from my project and put them all in the user's Sheet template to avoid the library having to manage them. However, if I don't do that, I'm running into the issue of Google's security verification process, which seems like it can be very expensive and difficult.

Any assistance here would be greatly appreciated, including if there's a better way to do this overall. The bottom line questions are:

1) How should I handle the validation workflow?

2) Is it even possible to have the user's context apply via a gateway function in the library in the way I'm hoping, e.g. sending an email on their behalf?

3) Can I publish this project in some way other than via testing (with a limit of 100 accounts) which doesn't require me to undergo the validation process? Or, is there a way to make that process less exorbitantly expensive?

4) Is there a better way to handle this overall?

Thanks so much for any help!

0 0 55
0 REPLIES 0
Top Solution Authors