How to run a scheduled task without checking any permission at all?

Hi there,

We would like to schedule a task to run once a day to update information in the database.

This custom function is heavily composed of many queries and mutations.

We want to globally disable checkPermissions for each API calls within this custom function?

How could we achieve that other than manually adding { checkPermissions: false } on every single API call?

Thanks and merry Xmas,

Regards,

Andréas

Hello Andréas!

Merry Xmas! I’ll give you a response soon.

Lada Kokotova | Technical Support Engineer

Hello Andréas!

You can achieve that other than manually adding { checkPermissions: false } on every single API call by wrapper.

Create wrapper:

    function runWithoutPermissions(context, query, variables) {
      return context.api.gqlRequest(query, variables, { checkPermissions: false });
    }

Then replace in the code:

context.gqlRequest( -> runWithoutPermissions(context,

Please let me know if you have any questions.

Lada Kokotova | Technical Support Engineer

Thanks for your suggestion!

We already have similar wrappers around our API calls, in which we also pass checkPermissions as a parameter.

The question was rather to know if wrapping API calls inside of a task and launching this task without checking permission could solve the problem.

But after deeper research, I came to understand that launching a task without permission doesn’t imply that the nested API calls will be launched without checking permissions.

So finally, we ended up manually adding { checkPermissions: false } everywhere we needed it.

Thanks,

Andréas

2 Likes