Created
May 12, 2022 13:58
-
-
Save hamiltop/fd11a4b6d9b556127e9c590b84fdf642 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Access to an organization's FTP credentials | |
Before: | |
async sftpCredentials(args: any, ctx: Context) { | |
return ctx.loaders.FeatureCredentials.getSftpCredentials(args.orgUuid, 'auto-messaging'); | |
}, | |
After | |
async sftpCredentials(args: any, ctx: Context) { | |
// We need to have an authenticated user who is an admin for the org uuid | |
// See https://app.asana.com/0/1142193044639890/1201986092349803/f | |
const authenticatedAdmin = await isCurrentUserAnAdminForOrg(ctx, args.orgUuid); | |
if (!authenticatedAdmin) { | |
// this field is required to be a list. For an unauthenticated request, just return an empty list. | |
return []; | |
} | |
return ctx.loaders.FeatureCredentials.getSftpCredentials(args.orgUuid, 'auto-messaging'); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment