Created
May 9, 2017 19:28
-
-
Save mlutfy/ec3d0f55638d775d65a0a4d5222425cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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