public function isModuleActionPermitted($module = false, $action = false) { if ($module === false && isset($_REQUEST["m"])) { $module = $_REQUEST["m"]; } if ($action === false && isset($_REQUEST["a"])) { $action = $_REQUEST["a"]; } /** * if module not set, it is home module. It is allowed */ if ($module === false) { return true; } $data_item_type = 0; $actionMapping = array(); switch ($module) { case 'candidates': $data_item_type = 100; $actionMapping = Candidates::actionMapping(); break; case 'companies': $data_item_type = 200; $actionMapping = Companies::actionMapping(); break; case 'contacts': $data_item_type = 300; $actionMapping = Contacts::actionMapping(); break; case 'joborders': $data_item_type = 400; $actionMapping = JobOrders::actionMapping(); break; } /** * if $data_item_type is 0, it indicates other modules. so it is allowed */ if ($data_item_type <= 0) { return true; } $modulePermission = isset($this->permission[$data_item_type]) ? $this->permission[$data_item_type] : array(); /** * checks whether any one operation is allowed */ $isModulePermited = false; if ($modulePermission) { foreach ($modulePermission as $operation => $permission) { if ($permission > 0) { $isModulePermited = true; break; } } } /** * since all the operation is not allowed, don't allow */ if ($isModulePermited === false) { return false; } /** * if $action is false, check whether default action exist in action mapping */ if ($action === false) { if (isset($actionMapping["default"])) { $action = $actionMapping["default"]; } } if (!isset($actionMapping[$action])) { return true; } $operation = $actionMapping[$action]; /** * if the action allowed */ if (isset($modulePermission[$operation]) && $modulePermission[$operation] > 0) { return true; } return false; }
<?php //trace("======"); /* * CandidATS * Sites Management * * Copyright (C) 2014 - 2015 Auieo Software Private Limited, Parent Company of Unicomtech. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ ob_start(); TemplateUtility::printHeader('Company - '.$this->data['name'], array( 'js/sorttable.js', 'js/attachment.js')); $AUIEO_HEADER= ob_get_clean(); $objRole=Users::getInstance()->getRole(); $allowDelete=$objRole->getModulePermission(200, Companies::actionMapping("delete")); $allowEdit=$objRole->getModulePermission(200, Companies::actionMapping("edit")); $AUIEO_CONTENT=""; ob_start(); ?> <p class="note">Company Details</p> <table class="detailsOutside" width="100%"> <tr style="vertical-align:top;"> <td width="50%" height="100%"> <table class="detailsInside" height="100%"> <tr> <td class="vertical">Name:</td> <td class="data">