| 1 |
<?php |
<?php |
| 2 |
// $Id: tac_lite.module,v 1.7 2008/06/04 05:02:11 yogadex Exp $ |
// $Id: tac_lite.module,v 1.8 2008/06/07 01:42:06 yogadex Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* Control access to site content based on taxonomy, roles and users. |
* Control access to site content based on taxonomy, roles and users. |
| 42 |
function tac_lite_menu() { |
function tac_lite_menu() { |
| 43 |
global $user; |
global $user; |
| 44 |
$items = array(); |
$items = array(); |
|
$admin_access = user_access('administer_tac_lite'); |
|
| 45 |
|
|
| 46 |
$items['admin/user/access/tac_lite'] = |
$items['admin/user/access/tac_lite'] = |
| 47 |
array('title' => t('Access control by taxonomy'), |
array('title' => t('Access control by taxonomy'), |
| 50 |
'page arguments' => array('tac_lite_admin_settings'), |
'page arguments' => array('tac_lite_admin_settings'), |
| 51 |
'type' => MENU_NORMAL_ITEM, |
'type' => MENU_NORMAL_ITEM, |
| 52 |
'weight' => 1, // after 'roles' tab |
'weight' => 1, // after 'roles' tab |
| 53 |
'access arguments' => array($admin_access), |
'access arguments' => array('administer_tac_lite'), |
| 54 |
); |
); |
| 55 |
|
|
| 56 |
$items['admin/user/access/tac_lite/settings'] = |
$items['admin/user/access/tac_lite/settings'] = |
| 57 |
array('title' => t('Settings'), |
array('title' => t('Settings'), |
| 58 |
'type' => MENU_DEFAULT_LOCAL_TASK, |
'type' => MENU_DEFAULT_LOCAL_TASK, |
| 59 |
'weight' => -1, |
'weight' => -1, |
| 60 |
'access arguments' => array($admin_access), |
'access arguments' => array('administer_tac_lite'), |
| 61 |
); |
); |
| 62 |
/* XXX |
|
|
$items['admin/user/access/tac_lite/roles'] = |
|
|
array('title' => t('Role based privileges'), |
|
|
'page callback' => 'drupal_get_form', |
|
|
'page arguments' => array('tac_lite_admin_settings_defaults'), |
|
|
'type' => MENU_LOCAL_TASK, |
|
|
'access arguments' => array($admin_access) |
|
|
); |
|
|
*/ |
|
| 63 |
$schemes = variable_get('tac_lite_schemes', 1); |
$schemes = variable_get('tac_lite_schemes', 1); |
| 64 |
for ($i = 1; $i <= $schemes; $i++) { |
for ($i = 1; $i <= $schemes; $i++) { |
| 65 |
$items['admin/user/access/tac_lite/scheme_' . $i] = |
$items['admin/user/access/tac_lite/scheme_' . $i] = |
| 67 |
'page callback' => 'tac_lite_admin_settings_scheme', |
'page callback' => 'tac_lite_admin_settings_scheme', |
| 68 |
'page arguments' => array((string)$i), |
'page arguments' => array((string)$i), |
| 69 |
'type' => MENU_LOCAL_TASK, |
'type' => MENU_LOCAL_TASK, |
| 70 |
'access arguments' => array($admin_access), |
'access arguments' => array('administer_tac_lite'), |
| 71 |
); |
); |
| 72 |
} |
} |
| 73 |
|
|