Need to add the entity type name in front of Image::TAG_CREATED_BY_UID as a prefix like ImageEditForm ("{$entity->getEntityTypeId()}_{Image::TAG_CREATED_BY_UID}").
Can you add a @thow \Exception comment to the comment?
I'm attaching a screenshot of a permission error I am encountering. I configured it so that "Authenticated users" can only view their own Images. In the screenshot, the browser is logged in as an "Authenticated user", but can still see the entire list of images.
The issue happens because Views does not perform permission checking on each entity returned in a query result.
To fix, please review aws_cloud_query_aws_cloud_image_views_access_alter() , and ImageViewsData class . You will need to add a query tag in the views definition. For example in ImageViewsData: $data['aws_cloud_image']['table']['base']['access query tag'] = 'aws_cloud_image_views_access';
Then in openstack.module, you will need to implement something similar to aws_cloud_query_aws_cloud_image_views_access_alter(AlterableInterface $query) to check if an openstack_cloud_image uid = $account->id()
I found the following warnings by phpcs. We don't need to implement __construct since the parent constructor now accepts $ec2_service as an object? Could you please check it?
$ phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md /var/www/html/web/modules/contrib/cloud
FILE: /var/www/html/web/modules/contrib/cloud/modules/cloud_service_providers/openstack/src/Controller/ApiController.php
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
270 | ERROR | Throws comment indentation must be 3 spaces, found 2 spaces
------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/web/modules/contrib/cloud/modules/cloud_service_providers/openstack/src/Form/OpenStackImageDeleteForm.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
43 | WARNING | Possible useless method overriding detected
-----------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/web/modules/contrib/cloud/modules/cloud_service_providers/openstack/src/Form/OpenStackImageEditForm.php
---------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------
55 | WARNING | Possible useless method overriding detected
---------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/web/modules/contrib/cloud/modules/cloud_service_providers/openstack/src/Form/OpenStackImageCreateForm.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
56 | WARNING | Possible useless method overriding detected
-----------------------------------------------------------------------------------------------------------------------------
Comments
Comment #2
jigish.addweb commentedComment #3
yas@jigishaddweb
Thank you for adding the feature. Please refer to my comment at #3121323-4.
Also,
This should remain the same as the original one,
openstack_cloud_config_iconis correct since the magic format is<MODULE_NAME>_cloud_config_icon.Comment #4
jigish.addweb commented@yas
I refactored the code as per your comment.
Please test updated patch.
Thanks
Comment #5
jigish.addweb commented@yas
I deleted OpenStackImageInterface file as that is not empty interface.
Please test new patch.
Thanks
Comment #6
jigish.addweb commented@yas
I refactored the code.
Please test updated patch.
Thanks
Comment #7
yas@jigishaddweb
Thank you for the update. The following is my feedback:
Need to modify PHPDoc
Need to add the entity type name in front of
Image::TAG_CREATED_BY_UIDas a prefix likeImageEditForm("{$entity->getEntityTypeId()}_{Image::TAG_CREATED_BY_UID}").FROM:
TO:
Please put the comment for the reason why you changed this condition.
OpenStack Cloud → OpenStack
openstack → OpenStack
FROM:
TO:
OpenStack Cloud → OpenStack
This change should happen in Drupal\aws_cloud\Entity\Ec2\ImageInterface
OpenStack Cloud → OpenStack
Comment #8
jigish.addweb commented@yas
Thank you for reviewing the patch.
I changed the code as per your above comment.
Please test updated patch.
Thanks
Comment #9
yasAs per we discussed on online meeting, let us change the status to Needs work.
Comment #10
jigish.addweb commented@yas
I have done all changes as per our discussion of online meeting.
Please review the new patch.
Thanks
Comment #11
jigish.addweb commented@yas
I have done some changes in code.
Please test new patch.
Thanks
Comment #12
baldwinlouie commented@jigish, I have the following comments.
Can you add a @thow \Exception comment to the comment?
The issue happens because Views does not perform permission checking on each entity returned in a query result.
To fix, please review
aws_cloud_query_aws_cloud_image_views_access_alter(), andImageViewsDataclass . You will need to add a query tag in the views definition. For example in ImageViewsData:$data['aws_cloud_image']['table']['base']['access query tag'] = 'aws_cloud_image_views_access';Then in openstack.module, you will need to implement something similar to
aws_cloud_query_aws_cloud_image_views_access_alter(AlterableInterface $query)to check if an openstack_cloud_image uid = $account->id()Comment #13
jigish.addweb commented@baldwinlouie
I fixed the permission issue and done changes as per your above comment.
Please review new patch.
Thanks
Comment #14
baldwinlouie commented@jigish,
Thank you for the changes. I tested it locally, and it looks good to me.
Comment #15
yas@baldwinlouie
Thank you for your review.
@jigishaddweb
Thank you for the update. The patch looks beautiful now, so I'll merge the patch to
8.x-1.xand8.x-2.xand close this issue asFixed.Comment #18
yasComment #19
yas@jigishaddweb
I'm re-opening this issue:
__constructsince the parent constructor now accepts$ec2_serviceas anobject? Could you please check it?https://git.drupalcode.org/project/cloud/-/blob/8.x-2.x/modules/cloud_se...
$this->tempStore = $temp_store_factory->get('entity_delete_multiple_confirm');Could you please check it?
Comment #20
jigish.addweb commented@yas
I fixed the coding standard violations and removed the code as per your previous comment.
Please test the new patch.
Thanks
Comment #21
yas@jigishaddweb
Thank you for the refactoring. It looks good to me now. I'll merge the patch to
8.x-1.xand8.x-2.xand close this issue asFixed.Comment #24
yasComment #25
yas