logintoboggan_content_access_integration.install in LoginToboggan 7
File
contrib/logintoboggan_content_access_integration/logintoboggan_content_access_integration.install
View source
<?php
function logintoboggan_content_access_integration_enable() {
if (logintoboggan_validating_id() == DRUPAL_AUTHENTICATED_RID) {
return;
}
$rebuild = array();
foreach (content_access_get_settings() as $permission => $content_types) {
foreach ($content_types as $content_type => $roles) {
if (!is_array($roles)) {
continue;
}
$roles_set = array_diff(array(
DRUPAL_AUTHENTICATED_RID,
DRUPAL_ANONYMOUS_RID,
), $roles);
if (empty($roles_set) && !in_array(logintoboggan_validating_id(), $roles)) {
drupal_set_message(t('The "@content_type" content type has the "@permission" permission set for Anonymous and Authenticated roles, but not Non-Authenticated. ' . 'You should grant this permission to the Non-Authenticated role if all users should continue to have access. ', array(
'@content_type' => $content_type,
'@permission' => $permission,
)) . l(t('Go to the Access Control Settings page.'), 'admin/content/node-type/' . $content_type . '/access'), 'warning');
}
if (in_array($content_type, $rebuild)) {
continue;
}
$roles_set = array_diff(array(
DRUPAL_AUTHENTICATED_RID,
logintoboggan_validating_id(),
), $roles);
if (empty($roles_set) && !in_array(DRUPAL_ANONYMOUS_RID, $roles)) {
$rebuild[] = $content_type;
}
}
}
if ($rebuild) {
node_access_needs_rebuild(TRUE);
}
}