Issue
-
When impersonating a user with permissions to add items to a cart, a message is seen in the UI, which says: “Danger: [object Object]” and the items do not get added to the cart.
-
This behavior can be seen by following these steps:
- Create two users, one as User One (user1@liferay.com) Screen name: user1 and the second as User Two (user2@liferay.com) Screen name: user2
- Create two Accounts (1 and 2)
- Assign User One and User Two respectively to Account 1 and 2
- Assign both users from within each account to the Buyer role
- Create a new site with the Minium template
- Go to Control Panel > Users and Organizations
- Click on each user and then go to Memberships
- Associate each user with the Minium site previously created (Remember to save the changes, otherwise the membership won’t be applied)
- Go to the Minium site as the Admin user still (Test Test)
- Add some items to the cart (This test I added the first two items)
- Check the cart to confirm if the items were added
- Go back to Go to Control Panel > Users and Organizations and impersonate either User One or Two
- Go to the Minium site as the impersonated user
- Try to add the items to the cart (it can be any)
Environment
- Liferay PaaS
- Liferay Quarterly Release
Resolution
-
The cause of the issue is that the admin is impersonating a user that hasn’t verified their email yet.
-
If this property company.security.strangers.verify is set to true (the default value), the new users aren’t verified and so they don’t have permission to use headless APIs. That causes issues when browsing the catalog and fetching the cart/order.
-
This is an intended behavior of Liferay and therefore not considered a bug. The issue won’t occur if the admin impersonates a verified user, or if they verify the email of the users created in the reproduction steps.