How to use the @webiny/api-security.hasScope function in @webiny/api-security

To help you get started, we’ve selected a few @webiny/api-security examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webiny / webiny-js / packages / api-forms / src / plugins / graphql.js View on Github external
},
    security: {
        shield: {
            FormsQuery: {
                getSettings: hasScope("cms:settings"),
                getForm: hasScope("forms:form:crud"),
                listForms: hasScope("forms:form:crud"),
                listFormSubmissions: hasScope("forms:form:crud")
                // listPublishedForms: hasScope("forms:form:crud") // Expose publicly.
                // getPublishedForms: hasScope("forms:form:crud") // Expose publicly.
            },
            FormsMutation: {
                updateSettings: hasScope("cms:settings"),
                createForm: hasScope("forms:form:crud"),
                deleteForm: hasScope("forms:form:crud"),
                createRevisionFrom: hasScope("forms:form:revision:create"),
                updateRevision: hasScope("forms:form:revision:update"),
                publishRevision: hasScope("forms:form:revision:publish"),
                unpublishRevision: hasScope("forms:form:revision:unpublish"),
                deleteRevision: hasScope("forms:form:revision:delete"),
                exportFormSubmissions: hasScope("forms:form:submission:export")
                // saveFormView: hasScope("forms:form:revision:delete") // Expose publicly.
                // createFormSubmission: hasScope("forms:form:revision:delete") // Expose publicly.
            }
        }
    }
};
github webiny / webiny-js / packages / api-forms / src / plugins / graphql.js View on Github external
forms: emptyResolver
                },
                Mutation: {
                    forms: emptyResolver
                }
            },
            form.resolvers,
            formSubmission.resolvers,
            formsSettings.resolvers
        )
    },
    security: {
        shield: {
            FormsQuery: {
                getSettings: hasScope("cms:settings"),
                getForm: hasScope("forms:form:crud"),
                listForms: hasScope("forms:form:crud"),
                listFormSubmissions: hasScope("forms:form:crud")
                // listPublishedForms: hasScope("forms:form:crud") // Expose publicly.
                // getPublishedForms: hasScope("forms:form:crud") // Expose publicly.
            },
            FormsMutation: {
                updateSettings: hasScope("cms:settings"),
                createForm: hasScope("forms:form:crud"),
                deleteForm: hasScope("forms:form:crud"),
                createRevisionFrom: hasScope("forms:form:revision:create"),
                updateRevision: hasScope("forms:form:revision:update"),
                publishRevision: hasScope("forms:form:revision:publish"),
                unpublishRevision: hasScope("forms:form:revision:unpublish"),
                deleteRevision: hasScope("forms:form:revision:delete"),
                exportFormSubmissions: hasScope("forms:form:submission:export")
                // saveFormView: hasScope("forms:form:revision:delete") // Expose publicly.
github webiny / webiny-js / packages / api-mailchimp / src / index.js View on Github external
});
                            }

                            return new ErrorResponse({
                                message: e.message
                            });
                        }
                    },
                    updateSettings: resolveUpdateSettings(({ models }) => models.MailchimpSettings)
                }
            }
        },
        security: {
            shield: {
                MailchimpQuery: {
                    getSettings: hasScope("pb:settings")
                },
                MailchimpMutation: {
                    updateSettings: hasScope("pb:settings")
                }
            }
        }
    },
    {
        type: "api-page-builder-model",
        name: "api-page-builder-model-mailchimp-settings",
        model({ models, createBase }) {
            models.MailchimpSettings = mailchimpSettings({ createBase });
        }
    }
];
github webiny / webiny-js / packages / api-page-builder / src / plugins / graphql.js View on Github external
},
            page.resolvers,
            category.resolvers,
            menu.resolvers,
            settings.resolvers,
            install.resolvers
        )
    },
    security: {
        shield: {
            PbQuery: {
                getMenu: hasScope("pb:menu:crud"),
                listMenus: hasScope("pb:menu:crud"),
                getCategory: hasScope("pb:category:crud"),
                listCategories: hasScope("pb:category:crud"),
                listPages: hasScope("pb:page:crud"),
                listElements: hasScope("pb:element:crud"),
                oembedData: hasScope("pb:oembed:read")
            },
            PbMutation: {
                createMenu: hasScope("pb:menu:crud"),
                updateMenu: hasScope("pb:menu:crud"),
                deleteMenu: hasScope("pb:menu:crud"),
                createCategory: hasScope("pb:category:crud"),
                updateCategory: hasScope("pb:category:crud"),
                deleteCategory: hasScope("pb:category:crud"),

                createPage: hasScope("pb:page:crud"),
                deletePage: hasScope("pb:page:crud"),

                createRevisionFrom: hasScope("pb:page:revision:create"),
                updateRevision: hasScope("pb:page:revision:update"),
github webiny / webiny-js / packages / api-security / src / plugins / graphql.js View on Github external
)
        },
        security: {
            shield: {
                SecurityQuery: {
                    getGroup: hasScope("security:group:crud"),
                    listGroups: hasScope("security:group:crud"),
                    getRole: hasScope("security:role:crud"),
                    listRoles: hasScope("security:role:crud"),
                    getUser: hasScope("security:user:crud"),
                    listUsers: hasScope("security:user:crud")
                },
                SecurityMutation: {
                    createGroup: hasScope("security:group:crud"),
                    updateGroup: hasScope("security:group:crud"),
                    deleteGroup: hasScope("security:group:crud"),
                    createRole: hasScope("security:role:crud"),
                    updateRole: hasScope("security:role:crud"),
                    deleteRole: hasScope("security:role:crud"),
                    createUser: hasScope("security:user:crud"),
                    updateUser: hasScope("security:user:crud"),
                    deleteUser: hasScope("security:user:crud")
                }
            }
        }
    }
]: Array);
github webiny / webiny-js / packages / api-page-builder / src / plugins / graphql.js View on Github external
category.resolvers,
            menu.resolvers,
            settings.resolvers,
            install.resolvers
        )
    },
    security: {
        shield: {
            PbQuery: {
                getMenu: hasScope("pb:menu:crud"),
                listMenus: hasScope("pb:menu:crud"),
                getCategory: hasScope("pb:category:crud"),
                listCategories: hasScope("pb:category:crud"),
                listPages: hasScope("pb:page:crud"),
                listElements: hasScope("pb:element:crud"),
                oembedData: hasScope("pb:oembed:read")
            },
            PbMutation: {
                createMenu: hasScope("pb:menu:crud"),
                updateMenu: hasScope("pb:menu:crud"),
                deleteMenu: hasScope("pb:menu:crud"),
                createCategory: hasScope("pb:category:crud"),
                updateCategory: hasScope("pb:category:crud"),
                deleteCategory: hasScope("pb:category:crud"),

                createPage: hasScope("pb:page:crud"),
                deletePage: hasScope("pb:page:crud"),

                createRevisionFrom: hasScope("pb:page:revision:create"),
                updateRevision: hasScope("pb:page:revision:update"),
                publishRevision: hasScope("pb:page:revision:publish"),
                deleteRevision: hasScope("pb:page:revision:delete"),
github webiny / webiny-js / packages / api-files / src / plugins / graphql.js View on Github external
updateFile: resolveUpdate(getFile),
                    createFiles,
                    deleteFile,
                    install
                }
            }
        },
        security: {
            shield: {
                FilesQuery: {
                    getFile: hasScope("files:file:crud"),
                },
                FilesMutation: {
                    uploadFile: hasScope("files:file:crud"),
                    createFile: hasScope("files:file:crud"),
                    updateFile: hasScope("files:file:crud"),
                    deleteFile: hasScope("files:file:crud")
                }
            }
        }
    }
]: Array);
github webiny / webiny-js / packages / api-page-builder / src / plugins / graphql.js View on Github external
page.resolvers,
            category.resolvers,
            menu.resolvers,
            settings.resolvers,
            install.resolvers
        )
    },
    security: {
        shield: {
            PbQuery: {
                getMenu: hasScope("pb:menu:crud"),
                listMenus: hasScope("pb:menu:crud"),
                getCategory: hasScope("pb:category:crud"),
                listCategories: hasScope("pb:category:crud"),
                listPages: hasScope("pb:page:crud"),
                listElements: hasScope("pb:element:crud"),
                oembedData: hasScope("pb:oembed:read")
            },
            PbMutation: {
                createMenu: hasScope("pb:menu:crud"),
                updateMenu: hasScope("pb:menu:crud"),
                deleteMenu: hasScope("pb:menu:crud"),
                createCategory: hasScope("pb:category:crud"),
                updateCategory: hasScope("pb:category:crud"),
                deleteCategory: hasScope("pb:category:crud"),

                createPage: hasScope("pb:page:crud"),
                deletePage: hasScope("pb:page:crud"),

                createRevisionFrom: hasScope("pb:page:revision:create"),
                updateRevision: hasScope("pb:page:revision:update"),
                publishRevision: hasScope("pb:page:revision:publish"),
github webiny / webiny-js / packages / api-files / src / plugins / graphql.js View on Github external
uploadFiles,
                    createFile: resolveCreate(getFile),
                    updateFile: resolveUpdate(getFile),
                    createFiles,
                    deleteFile,
                    install
                }
            }
        },
        security: {
            shield: {
                FilesQuery: {
                    getFile: hasScope("files:file:crud"),
                },
                FilesMutation: {
                    uploadFile: hasScope("files:file:crud"),
                    createFile: hasScope("files:file:crud"),
                    updateFile: hasScope("files:file:crud"),
                    deleteFile: hasScope("files:file:crud")
                }
            }
        }
    }
]: Array);
github webiny / webiny-js / packages / api-security / src / plugins / graphql.js View on Github external
scopes: getRegisteredScopes
                    }
                },
                install.resolvers,
                role.resolvers,
                group.resolvers,
                user.resolvers
            )
        },
        security: {
            shield: {
                SecurityQuery: {
                    getGroup: hasScope("security:group:crud"),
                    listGroups: hasScope("security:group:crud"),
                    getRole: hasScope("security:role:crud"),
                    listRoles: hasScope("security:role:crud"),
                    getUser: hasScope("security:user:crud"),
                    listUsers: hasScope("security:user:crud")
                },
                SecurityMutation: {
                    createGroup: hasScope("security:group:crud"),
                    updateGroup: hasScope("security:group:crud"),
                    deleteGroup: hasScope("security:group:crud"),
                    createRole: hasScope("security:role:crud"),
                    updateRole: hasScope("security:role:crud"),
                    deleteRole: hasScope("security:role:crud"),
                    createUser: hasScope("security:user:crud"),
                    updateUser: hasScope("security:user:crud"),
                    deleteUser: hasScope("security:user:crud")
                }
            }
        }

@webiny/api-security

Security layer for the Webiny GraphQL API.

MIT
Latest version published 2 days ago

Package Health Score

75 / 100
Full package analysis

Popular @webiny/api-security functions

Similar packages