function tac_lite_user in Taxonomy Access Control Lite 5
Same name and namespace in other branches
- 6 tac_lite.module \tac_lite_user()
Implementation of hook_user().
File
- ./
tac_lite.module, line 234 - Control access to site content based on taxonomy, roles and users.
Code
function tac_lite_user($op, $edit, $account, $category = null) {
//drupal_set_message("tac_lite_user($op) called."); // debug
// only for administrators
global $user;
if (!user_access('administer_tac_lite')) {
return;
}
switch ($op) {
case 'categories':
return array(
array(
'name' => 'tac_lite',
'title' => 'Access control (tac_lite)',
),
);
break;
case 'form':
if ($category == 'tac_lite') {
$vids = variable_get('tac_lite_categories', null);
if (count($vids)) {
for ($i = 1; $i <= variable_get('tac_lite_schemes', 1); $i++) {
$config = _tac_lite_config($i);
if ($config['name']) {
$form['tac_lite'][$config['realm']] = array(
'#type' => 'fieldset',
'#title' => $config['name'],
'#description' => t('This scheme includes permissions %perms', array(
'%perms' => implode(' and ', $config['perms']),
)),
'#tree' => TRUE,
);
foreach ($vids as $vid) {
$v = taxonomy_get_vocabulary($vid);
$form['tac_lite'][$config['realm']][$vid] = _taxonomy_term_select($v->name, null, $account->tac_lite[$vid], $vid, '', true, '<' . t('none') . '>');
}
}
}
$form['tac_lite'][0] = array(
'#type' => 'markup',
'#value' => '<p>' . t('You may grant this user access based on the schemes and terms below. These permissions are in addition to <a href="!url">role based grants on scheme settings pages</a>.', array(
'!url' => url('admin/user/tac_lite/scheme/1'),
)) . "</p>\n",
'#weight' => -1,
);
return $form;
}
}
break;
case 'validate':
//print_r($edit);
//print_r($account);
break;
}
}