Setup ACL In Product

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 yıl önce
How to setup this in nopcommerce?

Some products should be hidden for the specific CLIENT group.


XPTO product is visible to all customers, except for customer "[email protected]".

Config 1:
[email protected]: Registered, ABC
ACL in XPTO PRODUCT: Admin, Guest

Note: Not word, because when another client registers it automatically enters the group REGISTERED and this product makes it invisible to him.


Config 2:
[email protected]: Guest, ABC
ACL in XPTO PRODUCT: Admin, Guest, Registered

Note: Not word, because the product is NOT invisible to ABC, it is part of the Guest group.


Config 2:
[email protected]: Guest, ABC
ACL in XPTO PRODUCT: Admin, Registered
Note: Not word, because no product appears in the store, if it is not registered.


I know I can make new url (multiple stores), but still .. how can I solve this?
7 yıl önce
I have read your question a few times, but still not sure I understand completely.

I think you are asking how to make a particular product accessible to particular customer ROLES only.
Is that correct?

So, by default you have a few roles in the system:

Guest..this is everyone who visits your website
Admin.. this is only the customers who should access the admin area
Forum Moderator.. this is a customer who can add, delete or edit forum topics
Registered.. this is a customer who has an account

You can create a new ROLE and manually add each customer who is qualified to see the XPTO product to this ROLE.
Those customers should be in the "Registered" role AND in the new special role:
CanSeeSpecialProducts..this is a customer who can see the XTPO product


Then on the edit product screen >> access control list >> you must check the box, then choose only the new special ROLE that is allowed to see the XTPO product.
7 yıl önce
shpsyte wrote:
How to setup this in nopcommerce?

Some products should be hidden for the specific CLIENT group.


XPTO product is visible to all customers, except for customer "[email protected]".

Config 1:
[email protected]: Registered, ABC
ACL in XPTO PRODUCT: Admin, Guest

Note: Not word, because when another client registers it automatically enters the group REGISTERED and this product makes it invisible to him.


Config 2:
[email protected]: Guest, ABC
ACL in XPTO PRODUCT: Admin, Guest, Registered

Note: Not word, because the product is NOT invisible to ABC, it is part of the Guest group.


Config 2:
[email protected]: Guest, ABC
ACL in XPTO PRODUCT: Admin, Registered
Note: Not word, because no product appears in the store, if it is not registered.


I know I can make new url (multiple stores), but still .. how can I solve this?

I dont think ACL, as it comes out of the box, will solve your case because it is meant for hiding products for everyone except of a specific customer role (see my post here)
7 yıl önce
Hello everyone,
Thanks for the reply, but I have analyzed and this configuration is not possible
I need to customize the code.


"Product: XTOP, see below how you would like it.

Guest .. can see.
Admin .. can see.
Registered .. can see.
ABC .. can not see.

So in the product I put in the ACL: GUEST, ADMIN, REGISTERED

When the customer (Role ABC) enters the site, he will see the product, as it is part of the registered group.

So in the product I put it in ACL: GUEST, ADMIN

When the customer (Role ABC) enters the site, he does not see the product, but all other registered ones do not see either. "

It is not possible, because at some point I will hide the product for REGISTERED or GUEST, and this was not possible.


So I had to change the code: (I confess that it is not yet certain of that)


Method: Authorize in AclService.cs

            Bool return = true;
            Foreach (var role1 in customer.CustomerRoles.Where (cr => cr.Active))
            {

                //Guest alws visible.. sorry for hardcode :(
                 If (role1.Id == 4)
                {
                    Return = true;
                }
                Else
                {
                    Foreach (var role2Id in GetCustomerRoleIdsWithAccess (entity))
                        // Aker = Aker, Registered
                        // produot is invisible to aker
                        If (role1Id == role2Id)
                        {
                            //
                            Return = false;
                        }
                }
            }


I also changed a stored procedure


As the client wanted to work I left it that way, but I left it to analyze how to improve and create a plugin that makes the ACL work the other way around, ie define who I want to hide for.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.