hasAccess
For use with Netlify Visual Editor only.
connector.hasAccess(fn)
Used to check whether the current user has the necessary permissions to update content in the data source. Netlify calls this method when a user opens a site in the visual editor.
Takes a function with an object as a parameter. The object contains the following property:
Parameter | Description |
---|---|
userContext | Object with information about the current user. |
The function must return a Promise that resolves an object with the following properties:
Property | Description |
---|---|
hasConnection | Boolean. Set to true if the current user has connected to the data source. Usually, the existence of the OAuth accessToken indicates that the user has a connection. |
hasPermissions | Boolean. Set to true if the user’s accessToken allows them to perform create, update, and delete operations on the content within the data source. |
If your data source does not have an OAuth integration with Netlify, you can return true
for both values.
userContext
Object that contains information about the current user. Contains the following properties:
Property | Description |
---|---|
email | String representing the Netlify user’s email address. |
name | String representing the Netlify user’s username. |
sso | (optional) Object containing other user-specific OAuth tokens for communicating with the data source. |
userContext | Object with information about the current user. If your connector has an OAuth integration with the visual editor, use the accessToken on this object to validate the user’s access. |