LPS-42956

Hey Hugo,

I left the duplication in there because we could not think of a better way to reduce the code without potentially breaking other implementations. The issue is that this check originally checked for permissions based on the first portlet that it encountered. This caused a problem when there were multiples of the same portlet on the same page since they could have separate permissions. This change forces it to find the exact portlet and check those permissions instead of just any of the portlets. If you have any questions, let me know.

Thanks.