示例#1
0
 public function checkPermission(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $moduleModel = ITS4YouReports_ITS4YouReports_Model::getInstance($moduleName);
     $currentUserPriviligesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
     if (!$currentUserPriviligesModel->hasModulePermission($moduleModel->getId())) {
         throw new AppException('LBL_PERMISSION_DENIED');
     }
     $record = $request->get('record');
     if ($record) {
         $reportModel = ITS4YouReports_Record_Model::getCleanInstance($record);
         if (!$reportModel->isEditable()) {
             throw new AppException('LBL_PERMISSION_DENIED');
         }
     }
 }
示例#2
0
 /**
  * Function to get the list of listview links for the module
  * @return <Array> - Associate array of Link Type to List of Vtiger_Link_Model instances
  */
 public function getListViewLinks()
 {
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $privileges = Users_Privileges_Model::getCurrentUserPrivilegesModel();
     $basicLinks = array();
     if ($currentUserModel->isAdminUser() || $privileges->hasModulePermission($this->getModule()->getId())) {
         $basicLinks = array(array('linktype' => 'LISTVIEWBASIC', 'linklabel' => vtranslate('LBL_ADD_TEMPLATE', 'ITS4YouReports'), 'linkurl' => $this->getCreateRecordUrl(), 'linkicon' => ''), array('linktype' => 'LISTVIEWBASIC', 'linklabel' => 'LBL_ADD_FOLDER', 'linkurl' => 'javascript:ITS4YouReports_List_Js.triggerAddFolder("' . $this->getModule()->getAddFolderUrl() . '")', 'linkicon' => ''));
     }
     foreach ($basicLinks as $basicLink) {
         $links['LISTVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($basicLink);
     }
     if ($currentUserModel->isAdminUser()) {
         $SettingsLinks = ITS4YouReports_ITS4YouReports_Model::GetAvailableSettings();
         foreach ($SettingsLinks as $stype => $sdata) {
             $s_parr = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => $sdata["label"], 'linkurl' => $sdata["location"], 'linkicon' => '');
             $links['LISTVIEWSETTING'][] = Vtiger_Link_Model::getInstanceFromValues($s_parr);
         }
     }
     return $links;
 }