function getPermissions($user_id, $company_id) { $plf = new PermissionListFactory(); $cache_id = 'permission::all' . $user_id . $company_id; $perm_arr = $plf->getCache($cache_id); //Debug::Arr($perm_arr, 'Cached Perm Arr:', __FILE__, __LINE__, __METHOD__,9); if ($perm_arr === FALSE) { $plf->getAllPermissionsByCompanyIdAndUserId($company_id, $user_id); if ($plf->getRecordCount() > 0) { //Debug::Text('Found Permissions in DB!', __FILE__, __LINE__, __METHOD__,9); $perm_arr['_system']['last_updated_date'] = NULL; foreach ($plf as $p_obj) { //Debug::Text('Perm - Section: '. $p_obj->getSection(), __FILE__, __LINE__, __METHOD__,9); if ($p_obj->getUpdatedDate() > $perm_arr['_system']['last_updated_date']) { $perm_arr['_system']['last_updated_date'] = $p_obj->getUpdatedDate(); } $perm_arr[$p_obj->getSection()][$p_obj->getName()] = $p_obj->getValue(); } $plf->saveCache($perm_arr, $cache_id); return $perm_arr; } } return $perm_arr; }