diff --git a/config.php b/config.php index b83496470..62d4f18df 100755 --- a/config.php +++ b/config.php @@ -280,24 +280,31 @@ /* Job Types mapping */ /* Uncomment bellow if you want custom mapping */ -/*const JOB_TYPES_LIST = array( - 'PT' => 'Part-Time', - 'FT' => 'Full-Time', - 'ST' => 'Student', - 'FL' => 'Freelance' -);*/ - - -/* -require_once('.\constants.php'); -// defining user roles -const USER_ROLES = array( +/* +class JOB_TYPES { + public static $LIST = array( + 'PT' => 'Part-Time', + 'FT' => 'Full-Time', + 'ST' => 'Student', + 'FL' => 'Freelance' + ); +}; +*/ + + +/* +require_once('./constants.php'); + +class ACL_SETUP { + + // defining user roles + public static $USER_ROLES = array( 'candidate' => array('Candidate', 'candidate', 'This is a candidate.', ACCESS_LEVEL_SA, ACCESS_LEVEL_READ), 'demo' => array('Demo', 'demo', 'This is a demo user.', ACCESS_LEVEL_SA, ACCESS_LEVEL_READ) ); - -// defining access levels different from the default access level -const ACCESS_LEVEL_MAP = array( + + // defining access levels different from the default access level + public static $ACCESS_LEVEL_MAP = array( 'candidate' => array( ), 'demo' => array( @@ -308,7 +315,9 @@ 'joborders.show' => ACCESS_LEVEL_DEMO, 'joborders.email' => ACCESS_LEVEL_DISABLED, ) - );*/ + ); +}; +*/ /* All possible secure object names 'candidates.history' diff --git a/lib/ACL.php b/lib/ACL.php index 91f663f49..edd3d9783 100644 --- a/lib/ACL.php +++ b/lib/ACL.php @@ -21,23 +21,27 @@ class ACL * Example: const CATEGORY_DISABLED = '#'; - const ACCESS_LEVEL_MAP = array( - 'recruiter' => array( - 'calendar' => ACCESS_LEVEL_DELETE, - 'candidates'=> ACCESS_LEVEL_DELETE, - 'candidates.add'=> ACCESS_LEVEL_DISABLED - ), - 'candidate' => array( - ACL::SECOBJ_ROOT => ACCESS_LEVEL_DISABLED, - 'news' => ACCESS_LEVEL_READ, - ), - ACL::CATEGORY_EMPTY => array( - ACL::SECOBJ_ROOT => ACCESS_LEVEL_READ - ), - ACL::CATEGORY_DISABLED => array( - ACL::SECOBJ_ROOT => ACCESS_LEVEL_DISABLED - ) - + class ACL_SETUP { + public static $USER_ROLES = array( + 'demo' => array('Demo', 'demo', 'This is a demo user.', ACCESS_LEVEL_SA, ACCESS_LEVEL_READ) + ); + public static $ACCESS_LEVEL_MAP = array( + 'recruiter' => array( + 'calendar' => ACCESS_LEVEL_DELETE, + 'candidates'=> ACCESS_LEVEL_DELETE, + 'candidates.add'=> ACCESS_LEVEL_DISABLED + ), + 'candidate' => array( + ACL::SECOBJ_ROOT => ACCESS_LEVEL_DISABLED, + 'news' => ACCESS_LEVEL_READ, + ), + ACL::CATEGORY_EMPTY => array( + ACL::SECOBJ_ROOT => ACCESS_LEVEL_READ + ), + ACL::CATEGORY_DISABLED => array( + ACL::SECOBJ_ROOT => ACCESS_LEVEL_DISABLED + ) + }; ); */ @@ -47,12 +51,12 @@ class ACL */ public static function getAccessLevel($securedObjectName, $userCategories, $defaultAccessLevel) { - if( !defined('ACCESS_LEVEL_MAP') || empty(ACCESS_LEVEL_MAP)) + if( !class_exists('ACL_SETUP') || empty(ACL_SETUP::$ACCESS_LEVEL_MAP)) { return $defaultAccessLevel; } - $aclmap = ACCESS_LEVEL_MAP; + $aclmap = ACL_SETUP::$ACCESS_LEVEL_MAP; $userCategory = ACL::CATEGORY_EMPTY; if( isset($userCategories) && count($userCategories) > 0 && isset($userCategories[0]) ) { diff --git a/lib/JobOrderTypes.php b/lib/JobOrderTypes.php index 60e306401..6a789f3bb 100644 --- a/lib/JobOrderTypes.php +++ b/lib/JobOrderTypes.php @@ -28,9 +28,9 @@ public function __construct() { */ public function getAll() { - if(defined('JOB_TYPES_LIST')) + if( class_exists('JOB_TYPES') && !empty(JOB_TYPES::$LIST) ) { - return JOB_TYPES_LIST; + return JOB_TYPES::$LIST; } else { diff --git a/modules/settings/SettingsUI.php b/modules/settings/SettingsUI.php index 42c2ffce1..b0b22b4e3 100755 --- a/modules/settings/SettingsUI.php +++ b/modules/settings/SettingsUI.php @@ -69,9 +69,9 @@ public function __construct() $this->_moduleTabText = 'Settings'; /* Only CATS professional on site gets to make career portal customizer users. */ - if(defined('USER_ROLES')) + if( class_exists('ACL_SETUP') && !empty(ACL_SETUP::$USER_ROLES) ) { - $this->_settingsUserCategories = USER_ROLES; + $this->_settingsUserCategories = ACL_SETUP::$USER_ROLES; } $mp = array( diff --git a/test/config.php b/test/config.php index e2e2da7f6..0c580d605 100644 --- a/test/config.php +++ b/test/config.php @@ -265,11 +265,13 @@ define ('LDAP_BIND_PASSWORD', 'password'); define ('LDAP_PROTOCOL_VERSION', 3); -const JOB_TYPES_LIST = array( - 'H' => 'Hire', - 'C' => 'Contract', - 'C2H' => 'Contract To Hire', - 'FL' => 'Freelance' -); +class JOB_TYPES { + public static $LIST = array( + 'H' => 'Hire', + 'C' => 'Contract', + 'C2H' => 'Contract To Hire', + 'FL' => 'Freelance' + ); +}; ?>