/** * Return list of values to validate object/entity/place/etc 'access' field against * when considering whether to display the item or not. This method is intended to be used * in web front-ends such as Pawtucket, not Providence, and so it does not currently consider the * user's login status or login-based roles. Rather, it only considers whether access settings checks * are enabled (via the 'dont_enforce_access_settings' configuration directive) and whether the user * is considered privileged. * * @param RequestHTTP $po_request The current request * @param array $pa_options Optional options. If omitted settings are taken application configuration file is used. Any array passed to this function should include the following keys: "dont_enforce_access_settings", "public_access_settings", "privileged_access_settings", "privileged_networks" * @return array An array of integer values that, if present in a record, indicate that the record should be displayed to the current user */ function caGetUserAccessValues($po_request, $pa_options = null) { if (!caGetOption('ignoreProvidence', $pa_options, false)) { if (defined("__CA_APP_TYPE__") && __CA_APP_TYPE__ == 'PROVIDENCE') { return null; } } $vb_dont_enforce_access_settings = isset($pa_options['dont_enforce_access_settings']) ? (bool) $pa_options['dont_enforce_access_settings'] : $po_request->config->get('dont_enforce_access_settings'); $va_privileged_access_settings = isset($pa_options['privileged_access_settings']) && is_array($pa_options['privileged_access_settings']) ? (bool) $pa_options['privileged_access_settings'] : (array) $po_request->config->getList('privileged_access_settings'); $va_public_access_settings = isset($pa_options['public_access_settings']) && is_array($pa_options['public_access_settings']) ? $pa_options['public_access_settings'] : (array) $po_request->config->getList('public_access_settings'); if (!$vb_dont_enforce_access_settings) { $va_access = array(); $vb_is_privileged = caUserIsPrivileged($po_request, $pa_options); if ($vb_is_privileged) { $va_access = $va_privileged_access_settings; } else { $va_access = $va_public_access_settings; } if ($po_request->isLoggedIn()) { $va_user_access = $po_request->user->getAccessStatuses(1); if (is_array($va_user_access)) { $va_access = array_unique(array_merge($va_access, $va_user_access)); } } return $va_access; } return array(); }
/** * Return list of values to validate object/entity/place/etc 'access' field against * when considering whether to display the item or not. This method is intended to be used * in web front-ends such as Pawtucket, not Providence, and so it does not currently consider the * user's login status or login-based roles. Rather, it only considers whether access settings checks * are enabled (via the 'dont_enforce_access_settings' configuration directive) and whether the user * is considered privileged. * * @param RequestHTTP $po_request The current request * @param array $pa_options Optional options. If omitted settings are taken application configuration file is used. Any array passed to this function should include the following keys: "dont_enforce_access_settings", "public_access_settings", "privileged_access_settings", "privileged_networks" * @return array An array of integer values that, if present in a record, indicate that the record should be displayed to the current user */ function caGetUserAccessValues($po_request, $pa_options = null) { $vb_dont_enforce_access_settings = isset($pa_options['dont_enforce_access_settings']) ? (bool) $pa_options['dont_enforce_access_settings'] : $po_request->config->get('dont_enforce_access_settings'); $va_privileged_access_settings = isset($pa_options['privileged_access_settings']) && is_array($pa_options['privileged_access_settings']) ? (bool) $pa_options['privileged_access_settings'] : (array) $po_request->config->getList('privileged_access_settings'); $va_public_access_settings = isset($pa_options['public_access_settings']) && is_array($pa_options['public_access_settings']) ? $pa_options['public_access_settings'] : (array) $po_request->config->getList('public_access_settings'); if (!$vb_dont_enforce_access_settings) { $vb_is_privileged = caUserIsPrivileged($po_request, $pa_options); if ($vb_is_privileged) { return $va_privileged_access_settings; } else { return $va_public_access_settings; } } return array(); }
/** * Return list of values to validate object/entity/place/etc 'access' field against * when considering whether to display the item or not. This method is intended to be used * in web front-ends such as Pawtucket, not Providence, and so it does not currently consider the * user's login status or login-based roles. Rather, it only considers whether access settings checks * are enabled (via the 'dont_enforce_access_settings' configuration directive) and whether the user * is considered privileged. * * @param RequestHTTP $po_request The current request * @param array $pa_options Optional options. If omitted settings are taken application configuration file is used. Any array passed to this function should include the following keys: "dont_enforce_access_settings", "public_access_settings", "privileged_access_settings", "privileged_networks" * @return array An array of integer values that, if present in a record, indicate that the record should be displayed to the current user */ function caGetUserAccessValues($po_request, $pa_options = null) { $vb_dont_enforce_access_settings = isset($pa_options['dont_enforce_access_settings']) ? (bool) $pa_options['dont_enforce_access_settings'] : $po_request->config->get('dont_enforce_access_settings'); $va_privileged_access_settings = isset($pa_options['privileged_access_settings']) && is_array($pa_options['privileged_access_settings']) ? (bool) $pa_options['privileged_access_settings'] : (array) $po_request->config->getList('privileged_access_settings'); $va_public_access_settings = isset($pa_options['public_access_settings']) && is_array($pa_options['public_access_settings']) ? $pa_options['public_access_settings'] : (array) $po_request->config->getList('public_access_settings'); if (!$vb_dont_enforce_access_settings) { $va_access = array(); $vb_is_privileged = caUserIsPrivileged($po_request, $pa_options); if ($vb_is_privileged) { $va_access = $va_privileged_access_settings; } else { $va_access = $va_public_access_settings; } if ($po_request->isLoggedIn()) { $va_user_access = $po_request->user->getAccessStatuses(1); if (is_array($va_user_access)) { $va_access = array_unique(array_merge($va_access, $va_user_access)); } } return $va_access; } return array(); }