我想根据自定义规则限制记录的编辑。我能够限制 ListView ,但似乎无法使编辑限制发挥作用。
在自定义 Controller 中,我有
class CustomOpportunitiesController extends SugarController {
protected function action_editview() {
$this->bean = new CustomOpportunity();
// parent::action_editview(); // There is no action_editview() in SugarController
$this->view_object_map['bean'] = $this->bean;
$this->view = 'edit';
}
但是,当我添加此内容时,每当我尝试编辑记录时,它都会转到“创建记录”!
这方面也绝对没有(有用的)文档。 http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/02_Application_Framework/ACL
版本 6.5.13。
(我在子类中也有代码,但现在已将其注释掉。)
class CustomOpportunity extends Opportunity {
// function ACLAccess($view,$is_owner='not_set') { ...
最佳答案
有多种方法可以实现这一目标。如果我们使用像您的代码中那样的自定义 Controller ,您可以尝试以下操作:
public function action_editview()
{
/* Set view */
if (/*your condition here*/)
{
$this->view = 'noaccess';
}
else
{
$this->view = 'edit';
}
}
希望这有帮助!
诗。您的代码似乎创建新记录的原因似乎是由于“$this->bean = new CustomOpportunity();” -line,您可以在其中用新的记录覆盖要编辑的 bean :-)
关于php - 限制 SugarCRM 中的编辑访问权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21871637/