Skip to content

Instantly share code, notes, and snippets.

@mlutfy
Created May 9, 2017 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlutfy/ec3d0f55638d775d65a0a4d5222425cf to your computer and use it in GitHub Desktop.
Save mlutfy/ec3d0f55638d775d65a0a4d5222425cf to your computer and use it in GitHub Desktop.
class CRM_SymbioTIC_Utils_Check_Permissions {
function check(&$messages) {
$config = CRM_Core_Config::singleton();
$error = FALSE;
$count = 0;
if ($config->userFramework == 'Drupal6') {
$count = CRM_Core_DAO::singleValueQuery("SELECT count(*)
FROM permission
WHERE rid = 1 AND perm like '%profile listings%'");
}
else {
$count = CRM_Core_DAO::singleValueQuery("SELECT count(*)
FROM role_permission
WHERE rid = 1 AND permission in ('profile listings', 'profile listings and forms')");
}
if ($count > 0) {
$messages[] = new CRM_Utils_Check_Message(
'symbiotic_permissions',
ts("The anonymous user has one of 'profile listings', 'profile listings and forms', 'profile view' permissions. Please double-check if this is OK. c.f. lab:1466."),
ts('CMS profile permissions allow access to profiles'),
\Psr\Log\LogLevel::CRITICAL,
'fa-check'
);
}
else {
$messages[] = new CRM_Utils_Check_Message(
'symbiotic_permissions',
ts('Profile permissions are OK.'),
ts('Profile Permissions'),
\Psr\Log\LogLevel::INFO,
'fa-check'
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment