Override Visibility Strategy while initializing Sugar Bean

Hello Folks,

I wanted to override visibility strategy defined in module bean class definition while initializing that bean.

For eg: I have a module called Test and I have defined following visibility in bean class.

class Test extends SugarBean

{

    public function __construct()

    {

         $this->addVisibilityStrategy("OwnerVisibility");

         parent::__construct();

    }

}

Now, while initializing bean, I wanted to override this strategy in some scenarios.

$testBean = BeanFactory::newBean("Test");

$testBean->addVisibilityStrategy("OwnerOrAdminVisibility");

But the above line is not working. I am not sure how to override the visibility already defined in bean definition.

Any help or idea would be greatly appreciated.

Regards.

Hats

Parents Reply
  • Hi Enrico Simonetti,

    Thank you so much for your reply.

    By mentioning "First of all, Admin users do not have visibility applied to them.", do you mean that admin user should be able to see all the records irrespective of the visibility set on the module ? For eg: If I want to fetch all records of a particular module whose visibility is set to "OwnerVisibility", can I get it using any admin user ? I tried to do so, but couldn't get all data. It's fetching only current user data. Please correct me if I am wrong.

    Regards.

    Hats

Children