Limit Product Item / Category access by team

We support multiple businesses on our CRM.  We are working to implement the Quotes module and I would like to limit the visibility of various Product Items by Team.  I would prefer to use Product Categories as the field to apply the Team's permission but could do it at  the part level as well.

I do not see Teams as an associated module with Product Catalog.  Is it possible to limit visibility to Product Items or Categories by Team?

Thank you.


Bob

product catalog  team team-based permissions

Parents
  • Hi Bob Schumann,

    We can enable team management for Product Catalog module but that requires a development effort.

    Please let us know if you are comfortable with sugar development and I will share the steps here.

    Regards.

    Hats

  • Hello Hats,

    I have some programming and database experience would like to try this.  Could you please send me the steps and I will try this in our sandbox.

    Thank you for your response.

    Best regards,
    Bob

  • Hi Bob Schumann,

    Please create a new vardef file inside custom/Extension/modules/ProductTemplates/Ext/Vardefs/sugarfield_teams.php with following contents:

    <?php

    /** use team_security template **/
    $dictionary['ProductTemplate']['uses'] = array('team_security');
    $dictionary['ProductTemplate']['visibility'] = array('TeamSecurity' => true);


    //create team related fields
    VardefManager::createVardef("ProductTemplates", "ProductTemplate", array('team_security'));

    - Run Quick Repair & Rebuild under Admin -> Repair

    - Execute the SQL query generated after the repair is completed

    - Navigate to the Admin -> Studio -> Product Catalog -> Layouts -> Record View and add Teams to the layout

    I understood from your comment that you are working on Sugar cloud so you need to package this customization to deploy using module loader. More info on this here - https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.9/Introduction/Development_Methodolog… 

    Let us know how it goes.

    Regards.

    Hats

  • This is not the enough once ProductTemplates' __construct method sets by default:

    $this->disable_row_level_security =true;

    So you also need to create an extended Include and define the following:

    $moduleList[] = 'ProductTemplates';
    $objectList['ProductTemplates'] = 'ProductTemplate';
    $beanList['ProductTemplates'] = 'CustomProductTemplate';
    $beanFiles['CustomProductTemplate'] = 'custom/modules/ProductTemplates/ProductTemplate.php';

    At last create the file custom/modules/ProductTemplates/ProductTemplate.php with that content:

    require_once('modules/ProductTemplates/ProductTemplate.php');

    class CustomProductTemplate extends ProductTemplate {
     public function __construct() {
     parent::__construct();
     $this->disable_row_level_security = false;
     }
    }

    Run the repair actions described by hats

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply
  • This is not the enough once ProductTemplates' __construct method sets by default:

    $this->disable_row_level_security =true;

    So you also need to create an extended Include and define the following:

    $moduleList[] = 'ProductTemplates';
    $objectList['ProductTemplates'] = 'ProductTemplate';
    $beanList['ProductTemplates'] = 'CustomProductTemplate';
    $beanFiles['CustomProductTemplate'] = 'custom/modules/ProductTemplates/ProductTemplate.php';

    At last create the file custom/modules/ProductTemplates/ProductTemplate.php with that content:

    require_once('modules/ProductTemplates/ProductTemplate.php');

    class CustomProductTemplate extends ProductTemplate {
     public function __construct() {
     parent::__construct();
     $this->disable_row_level_security = false;
     }
    }

    Run the repair actions described by hats

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Children
  • Thank you Hats - will give it a try in a week or two.  


    Bob

  • Thank you Andre' - will give it a try.


    Best regards,
    Bob

  • Thanks André Lopes for pointing that out.

    Sad thing is, bean override is still not supported via module loader. You need to raise a support case for such changes.

    I wish sugar dev team would lift off this restriction soon.

    Regards.

    Hats

  • That is weird!

    We have this vary same feature published in 2 sugarondemand customers instances.

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Ohh that's great. I tried in Ent 7.8.2.0 and it didn't work. Also, it got broken during sugar on-demand updates and they overridden my custom bean file with the standard one. I did customization in RLI bean.

    Never mind, I will give it a try again.

    Thanks André Lopes

  • Hi,

    I tried this, i can see team on the product record view page and i am able to assign team to product as well.

    But the visibility of product in revenue line item is not getting restricted by this. Everyone still can see all the products. We have a requirement where in East zone team should not see the product for West zone team.

    Thanks!

  • Hi Priyanka Kishor,

    You mean team visibility is not working at all even after assigning teams to Product records?

    If so, please check if you have overridden the product template bean class and have set 'disable_row_level_security' property to false as advised by André Lopes above:

    This is not the enough once ProductTemplates' __construct method sets by default:

    $this->disable_row_level_security =true;

    Modify custom product template bean construct method with following content:

    public function __construct() {
        parent::__construct();
        $this->disable_row_level_security = false;
    }

    Let us know if this helps.

  • Hi hats,

    Thank you for highlighting this. I somehow missed to configure this. I think I made changes directly in the Custom/application... include folder rather than making changes in custom/extension/application... include folder.  After making the changes again.. it started working.

    Thank you so much for your quick response.

    Also, I was wondering if it possible to add similar constrain while picking up the product from dashboard on the right pane on opportunity detail page.

    Thanks !

  • Hi Priyanka Kishor,

    I am not sure which dashboard you are referring to. If it is a standard dashlet/dashboard, it should follow the team security by default. No customization is needed.

    Maybe you can share some more details and I will see if I can help on that.

    Regards.

    Hats

  • Hi hats,

    Sorry for late response, I left for the day after messaging you.

    In the opportunity detail view, on the right side, the product dashlet is available with all the products and visibility is not restricted by team. However, if i select the product that is outside the logged in user's team, it gives me an error that you do not have enough privilege...

    So, is it possible to restrict the visibility here in the dashlet itself?

    Thanks and Regards,

    Priyanka