wp-webhook-netlify-deploy
wp-webhook-netlify-deploy copied to clipboard
ES6 - remove jQuery
refactor JavaScript code to allow to remove dependency on jQuery
Refactor the whole JavaScript side of the plugin to allow for dynamically pulling what is needed based on:
User Permissions/Roles
-
netlify_status_capability
// can see status of deploy -
netlify_deploy_capability
// can send a deploy -
netlify_adjust_settings_capability
// can adjust developer settings
and
User position
- Developer Settings Page
- General Deployment / Preview Page
- Non-Plugin based page (still need some js for admin bar functionality)
I can understand the need to refactor the JS outside of the PHP, but what is the reason for needing to only load specific sections? The code is so small that loading it all shouldn't make much difference?
Was considering more of the security aspect to it. Loading only what the currently logged in user should physically be able to do was the initial idea.
Suppose the worst they could do is fire off a few builds or edit some auth keys they arnt supposed to. Bit of over engineering for such a small plugin.
The security side could be managed via WordPress localisation. Keep JS the same, but only pass the access keys across if user has a specific role. That way if they do try and force it, they don't have any details to trigger. Would worse case scenario cause an error.