-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement access-limiting behaviour for Whitehall attachments in Asset Manager #450
Comments
I'm going to start working on this. |
I'm working on the changes necessary to Asset Manager in WIP: Allow draft asset access to be restricted to specific users #471. I'm working on the changes necessary to Whitehall in WIP: Send access_limited data to Asset Manager #3767. |
The changes in #471 and alphagov/whitehall#3767 have been deployed to production. @floehopper realised that we also need to handle attachments created by the |
I made the changes to the I plan to test the functionality in integration to ensure that it's working as expected. |
@chrisroos Does this work for |
Good question, @floehopper. I'll investigate. |
I've checked and believe that this will just work because setting
|
👍 |
I've just tested this in integration and think I've found a problem. The |
While investigating issue 450[1], I noticed that resetting/removing the access_limited status of an asset wasn't working as expected. This is because when we pass an empty `access_limited` array to gds-api-adapters/rest-client it's turned into an empty string in Asset Manager. The fix is to handle the empty string in the controller and convert it back into the empty array that's intended. I don't think this is particularly nice but I think it's good enough for now. [1]: #450
I've opened #510 to fix the problem that occurs when we try to reset the access-limited state of an asset. |
While investigating issue 450[1], I noticed that resetting/removing the access_limited status of an asset wasn't working as expected. This is because when we pass an empty `access_limited` array to gds-api-adapters/rest-client it's turned into an empty string in Asset Manager. This results in an `UnpermittedParameter` exception for the `access_limited` parameter in Asset Manager as it's expecting an Array but receives a String. The fix is to detect the empty string in the controller and convert it back into the empty array that's intended. I don't think this is particularly nice but I think it's good enough for now. Note that I haven't had to use `handle_empty_access_limited_param` in `WhitehallAssetsController#asset_params` as the problem only occurs when _updating_ an access-limited asset, and the `WhitehallAssetsController` is only responsible for _creating_ assets. [1]: #450
While investigating issue 450[1], I noticed that resetting/removing the access_limited status of an asset wasn't working as expected. This is because when we pass an empty `access_limited` array to gds-api-adapters/rest-client it's turned into an empty string in Asset Manager. This results in an `UnpermittedParameter` exception for the `access_limited` parameter in Asset Manager as it's expecting an Array but receives a String. The fix is to detect the empty string in the controller and convert it back into the empty array that's intended. I don't think this is particularly nice but I think it's good enough for now. Note that I haven't had to use `handle_empty_access_limited_param` in `WhitehallAssetsController#asset_params` as the problem only occurs when _updating_ an access-limited asset, and the `WhitehallAssetsController` is only responsible for _creating_ assets. I also considered using two fields to implement the access-limiting functionality: a boolean to control whether access-limiting was enabled in conjunction with an array of user UIDs who are authorised to view the asset. I decided against that approach because it's more work and because it means the implementation in Asset Manager diverges from the access-limiting functionality in the Content Store. [1]: #450
PR #510 has been merged and deployed to integration and I've now confirmed that this functionality is working as expected. I created an access-limited consultation in Whitehall integration and added two attachments: one directly and one via the bulk upload functionality. I observed that both attachments were marked as access-limited in Asset Manager. I then removed the access-limiting from the consultation and observed that both attachments were no longer marked as access-limited in Asset Manager. I'm happy that this is working as expected so I'm closing this issue. |
e.g. limited to groups of users in an organisation
The text was updated successfully, but these errors were encountered: