Example #1
0
 public function editRule(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     $forModule = $request->get('for_module');
     $ruleId = $request->get('record');
     $moduleModel = Settings_SharingAccess_Module_Model::getInstance($forModule);
     if ($ruleId) {
         $ruleModel = Settings_SharingAccess_Rule_Model::getInstance($moduleModel, $ruleId);
     } else {
         $ruleModel = new Settings_SharingAccess_Rule_Model();
         $ruleModel->setModuleFromInstance($moduleModel);
     }
     $viewer->assign('ALL_RULE_MEMBERS', Settings_SharingAccess_RuleMember_Model::getAll());
     $viewer->assign('ALL_PERMISSIONS', Settings_SharingAccess_Rule_Model::$allPermissions);
     $viewer->assign('MODULE_MODEL', $moduleModel);
     $viewer->assign('RULE_MODEL', $ruleModel);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     echo $viewer->view('EditRule.tpl', $qualifiedModuleName, true);
 }
Example #2
0
 public function deleteRule(Vtiger_Request $request)
 {
     $forModule = $request->get('for_module');
     $ruleId = $request->get('record');
     $moduleModel = Settings_SharingAccess_Module_Model::getInstance($forModule);
     $ruleModel = Settings_SharingAccess_Rule_Model::getInstance($moduleModel, $ruleId);
     $response = new Vtiger_Response();
     $response->setEmitType(Vtiger_Response::$EMIT_JSON);
     try {
         $ruleModel->delete();
     } catch (AppException $e) {
         $response->setError('Deleting Sharing Access Rule failed');
     }
     $response->emit();
 }
Example #3
0
 public function getRules()
 {
     return Settings_SharingAccess_Rule_Model::getAllByModule($this);
 }