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