ZeroNet icon indicating copy to clipboard operation
ZeroNet copied to clipboard

Remove permission api call

Open rllola opened this issue 6 years ago • 3 comments

This PR is a re-write of https://github.com/HelloZeroNet/ZeroNet/pull/1494

  • [x] It adds a wrapperPermissionRemove call. Calling wrapperPermissionRemove will 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/

rllola avatar Oct 02 '19 12:10 rllola

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.

purplesyringa avatar Oct 02 '19 14:10 purplesyringa

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.

HelloZeroNet avatar Oct 03 '19 15:10 HelloZeroNet

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.

purplesyringa avatar Oct 03 '19 15:10 purplesyringa