Change context in cron job

Enonic version: 6.13.1
OS: macOS Sierra 10.12.6

I have created a Cron Job and want to delete a node. I’ve changed context, but I’m still getting this response:
‘Access denied to [/verify/58679c7f-9134-377d-5b65-181dc5146579] for [DELETE] by user [unknown]’

I’ve tried this, but still get the user unknown message:{
            user: {
                login: 'su',
                userStore: 'system'
        }, function () {
                return repo.delete('58679c7f-9134-377d-5b65-181dc5146579');

Just found out that I could connect to the repo with the correct principal :slight_smile:
fixed with adding principals:

var repo = nodeLib.connect({
repoId: “cms-repo”,
branch: “master”,
principals: [“role:system.admin”]

Unsure if I should just delete the post, or leave it :slight_smile:

1 Like

It might help others so I’ll just close it but leave it here =) Thx for answering your own question.

1 Like