Remove permission api call
This PR is a re-write of https://github.com/HelloZeroNet/ZeroNet/pull/1494
-
[x] It adds a
wrapperPermissionRemovecall. CallingwrapperPermissionRemovewill prompt a notification message to ask user for confirmation. -
[x] If more than one permission is asked at the same time an error message will be send.
-
[x] If the permission is not already granted it will prompt an informative message.
-
[x] Also added a small the same behavior for
wrapperPermissionAdd; it will send an error if more than one permission being passed as an argument and prompt a notification if permission already granted.
NOTE: The wrapperPermissionAdd verification for already granted permission was failing because we are checking if Array is in Array because in the documentation we passed the permission as an array (https://zeronet.io/docs/site_development/zeroframe_api_reference/#wrapperpermissionadd). In order to avoid this I added an if statement to check we passed an array.
NOTE 2: A small site to test http://127.0.0.1:43111/1MMF8RiHAqU2Ac6guTX5KLBeEsat846ien/
I'm afraid the current implementation can give a false sense of security. A zite can draw a box similar to the real permission remove box, and the user would think that they removed the permission so they're now safe. This looks like a huge problem.
I don't think it's a huge problem (actually I'm not sure if we need confirmation on permission remove at all), but to improve the situation we could give different look to the confirm dialogs generated by the wrapper.
I think there's no point in the site removing its own permission. It makes more sense to make a single configuration page for all sites.