public function SiteAuditCheckRolesRolesPermissions::calculateScore in Site Audit 7
Implements \SiteAudit\Check\Abstract\calculateScore().
Overrides SiteAuditCheckAbstract::calculateScore
File
- Check/
Roles/ RolesPermissions.php, line 64 - Contains \SiteAudit\Check\Users\RolesPermissions.
Class
- SiteAuditCheckRolesRolesPermissions
- Class SiteAuditCheckRolesRolesPermissions.
Code
public function calculateScore() {
$sql_query = 'SELECT name';
$sql_query .= ', COUNT({role}.rid) AS count_permissions ';
$sql_query .= 'FROM {role} ';
$sql_query .= 'LEFT JOIN {role_permission} ON {role}.rid = {role_permission}.rid ';
$sql_query .= 'GROUP BY {role}.rid ';
$sql_query .= 'ORDER BY name ASC ';
$result = db_query($sql_query);
foreach ($result as $row) {
$this->registry['roles'][$row->name] = $row->count_permissions;
}
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO;
}