cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent synchronisation of unapproved products from staged to online?

abhinavsingh11
Participant
0 Kudos

Hi ,

We have a requirement where a product cockpit user should only be able to sync approved products from staged to online. The product cockpit user should be not be able to sync products whose approval status is checked or unapproved.

How can I achieve this?

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos
Former Member
0 Kudos
Former Member
0 Kudos

Hi, Shwetha,

There is one way to synchronize only approved products , we need to apply SearchRestriction (known also as Personalization Rule or Restriction) on synchronization.

1.Create a new user which will bound to the restriction and sync job

*Login hmc using an account which has sufficient privileges to manage user accounts and personalization rules

*Create a new user (here as an example: sync_only_approved_user) and not to assign any groups (Need to remove its default employee group) in order not to bring additional restrictions to obfuscate the results.

*Save the user!

2.Define a SearchRestriction for the technical user and product type with specific filter:

*Click on System and right click on Personalization to create a new personalization rule

*Enter the rule details and bound to Product and our newly create user, the filter is as follows: ({approvalStatus} IN ({{ select {pk} from {ArticleApprovalStatus} where {code}='approved'}}))

*Save the personalization rule

3.Set the user as the session user of the sync job

*First, let's make some products to "check" and "unapproved", then edit their identifiers

*Then go back to hmc, click on Catalog, then click on Catalog Management Tools, then click synchronization. We are using hybris OOTB electronics stores here, so lets pick the sync job, click next then right click on the job to edit it

*Go to Advanced Attribute and find Session Attributes then assign our sync_only_approved_user then save and exit the edit page

*Execute the synchronization, you will see the following warning in logs indicating we are using the correct user to sync and the rule applied and the log also depicted there is only 1 time been synced.

*The log looks like:

WARN [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncJob] Session user is not admin but sync_only_approved_user[8796125888516] - due to possible restrictions synchronization may not cover all items INFO [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncJob] Starting configuration ... INFO [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncJob] Sync 'sync electronicsProductCatalog:Staged->Online' (pk:8796094300660) conf igured 1 entries for job '000002BI' (pk:8796191556085) schedule medias: 1 INFO [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncJob] Finished configuration in 0d 00h:00m:00s:290ms. INFO [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncJob] Starting synchronization ... INFO [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncMaster] 1. pass, 0 (+0) of 1 items processed (0 %), 0.00 items/sec, 0 (+0) items dumped. INFO [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncJob] Finished synchronization in 0d 00h:00m:00s:440ms. No errors.

*Now let's go back to product cockpit and check again, the result listed as expected.

All the steps in screen copy as attached.

Regards

Haitao

abhinavsingh11
Participant
0 Kudos

Hi Shwetha,

I have tried to add this restriction

INSERT_UPDATE SearchRestriction;code[unique=true];principal(uid)[unique=true];query;restrictedType(code)[unique=true];active;generate ;publisherProductVisibility;publishergroup;{approvalStatus} = ({{select {PK} from {ArticleApprovalStatus} where {code}='approved'}});Product;true;true

but it seems to have no effect. I am still able to see unapproved and checked products in product cockpit

former_member469962
Contributor
0 Kudos

Hello,

Does your cockpit user (who logs in to perform synchronization) belong to the publishergroup?

-Shwetha

former_member469962
Contributor
0 Kudos

Hello Abhinav,

Have you tried creating a restriction/personalization rule for the cockpit user to "see" only approved products?

Br, Shwetha

abhinavsingh11
Participant
0 Kudos

Hi Shwetha,

I have tried to add this restriction

INSERT_UPDATE SearchRestriction;code[unique=true];principal(uid)[unique=true];query;restrictedType(code)[unique=true];active;generate ;publisherProductVisibility;publishergroup;{approvalStatus} = ({{select {PK} from {ArticleApprovalStatus} where {code}='approved'}});Product;true;true

but it seems to have no effect. I am still able to see unapproved and checked products in product cockpit