2 //First make sure user has access
3 include_once("../../interface/globals.php");
4 include_once("$srcdir/acl.inc");
5 //ensure user has proper access
6 if (!acl_check('admin', 'acl')) {
7 echo xl('ACL Administration Not Authorized');
10 //ensure php is installed
11 if (!isset($phpgacl_location)) {
12 echo xl('php-GACL access controls are turned off');
17 require_once('gacl_admin.inc.php');
19 //GET takes precedence.
20 if ($_GET['group_type'] != '') {
21 $group_type = $_GET['group_type'];
23 $group_type = $_POST['group_type'];
26 switch(strtolower(trim($group_type))) {
29 $group_table = $gacl_api->_db_table_prefix
. 'axo_groups';
30 $group_map_table = $gacl_api->_db_table_prefix
. 'groups_axo_map';
31 $smarty->assign('current','axo_group');
35 $group_table = $gacl_api->_db_table_prefix
. 'aro_groups';
36 $group_map_table = $gacl_api->_db_table_prefix
. 'groups_aro_map';
37 $smarty->assign('current','aro_group');
41 switch ($_POST['action']) {
46 $formatted_groups = $gacl_api->format_groups($gacl_api->sort_groups($group_type), HTML
);
49 SELECT a.id, a.name, a.value, count(b.'. $group_type .'_id)
50 FROM '. $group_table .' a
51 LEFT JOIN '. $group_map_table .' b ON b.group_id=a.id
52 GROUP BY a.id,a.name,a.value';
53 $rs = $db->Execute($query);
55 $group_data = array();
58 while($row = $rs->FetchRow()) {
59 $group_data[$row[0]] = array(
69 foreach($formatted_groups as $id => $name) {
72 // 'parent_id' => $parent_id,
73 // 'family_id' => $family_id,
75 'raw_name' => $group_data[$id]['name'],
76 'value' => $group_data[$id]['value'],
77 'object_count' => $group_data[$id]['count']
81 $smarty->assign('groups', $groups);
85 $smarty->assign('group_type', $group_type);
86 $smarty->assign('return_page', $_SERVER['REQUEST_URI']);
88 $smarty->assign('current', $group_type .'_group');
89 $smarty->assign('page_title', strtoupper($group_type) .' Group Admin');
91 $smarty->assign('phpgacl_version', $gacl_api->get_version());
92 $smarty->assign('phpgacl_schema_version', $gacl_api->get_schema_version());
94 $smarty->display('phpgacl/group_admin.tpl');