[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare - Administration * 4 * http://www.egroupware.org * 5 * -------------------------------------------- * 6 * This program is free software; you can redistribute it and/or modify it * 7 * under the terms of the GNU General Public License as published by the * 8 * Free Software Foundation; either version 2 of the License, or (at your * 9 * option) any later version. * 10 \**************************************************************************/ 11 12 /* $Id: class.uiaclmanager.inc.php 20295 2006-02-15 12:31:25Z $ */ 13 14 class uiaclmanager 15 { 16 var $template; 17 var $nextmatchs; 18 var $public_functions = array( 19 'list_apps' => True, 20 'access_form' => True, 21 'account_list' => True 22 ); 23 24 function uiaclmanager() 25 { 26 $this->account_id = (int)$_GET['account_id']; 27 if (!$this->account_id || $GLOBALS['egw']->acl->check('account_access',64,'admin')) 28 { 29 $GLOBALS['egw']->redirect_link('/index.php'); 30 } 31 $this->template =& CreateObject('phpgwapi.Template',EGW_APP_TPL); 32 } 33 34 function common_header() 35 { 36 $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin') . ' - ' . lang('ACL Manager') . 37 ': ' . $GLOBALS['egw']->common->grab_owner_name($this->account_id); 38 $GLOBALS['egw']->common->egw_header(); 39 echo parse_navbar(); 40 } 41 42 function list_apps() 43 { 44 $this->common_header(); 45 46 $GLOBALS['egw']->hooks->process('acl_manager',array('preferences')); 47 48 $this->template->set_file(array( 49 'app_list' => 'acl_applist.tpl' 50 )); 51 $this->template->set_block('app_list','list'); 52 $this->template->set_block('app_list','app_row'); 53 $this->template->set_block('app_list','app_row_noicon'); 54 $this->template->set_block('app_list','link_row'); 55 $this->template->set_block('app_list','spacer_row'); 56 57 if (is_array($GLOBALS['acl_manager'])) 58 { 59 foreach($GLOBALS['acl_manager'] as $app => $locations) 60 { 61 $icon = $GLOBALS['egw']->common->image($app,array('navbar.png',$app.'png','navbar.gif',$app.'.gif')); 62 $this->template->set_var('icon_backcolor',$GLOBALS['egw_info']['theme']['row_off']); 63 $this->template->set_var('link_backcolor',$GLOBALS['egw_info']['theme']['row_off']); 64 $this->template->set_var('app_name',$GLOBALS['egw_info']['apps'][$app]['title']); 65 $this->template->set_var('a_name',$appname); 66 $this->template->set_var('app_icon',$icon); 67 68 if ($icon) 69 { 70 $this->template->fp('rows','app_row',True); 71 } 72 else 73 { 74 $this->template->fp('rows','app_row_noicon',True); 75 } 76 77 if (is_array($locations)) 78 { 79 foreach($locations as $loc => $value) 80 { 81 $link_values = array( 82 'menuaction' => 'admin.uiaclmanager.access_form', 83 'location' => $loc, 84 'acl_app' => $app, 85 'account_id' => $this->account_id 86 ); 87 88 $this->template->set_var('link_location',$GLOBALS['egw']->link('/index.php',$link_values)); 89 $this->template->set_var('lang_location',lang($value['name'])); 90 $this->template->fp('rows','link_row',True); 91 } 92 } 93 94 $this->template->parse('rows','spacer_row',True); 95 } 96 } 97 $this->template->set_var(array( 98 'cancel_action' => $GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_users'), 99 'lang_cancel' => lang('Cancel') 100 )); 101 $this->template->pfp('out','list'); 102 } 103 104 function access_form() 105 { 106 $location = $_GET['location']; 107 108 if ($_POST['submit'] || $_POST['cancel']) 109 { 110 if ($_POST['submit']) 111 { 112 $total_rights = 0; 113 if (is_array($_POST['acl_rights'])) 114 { 115 foreach($_POST['acl_rights'] as $rights) 116 { 117 $total_rights += $rights; 118 } 119 } 120 if ($total_rights) 121 { 122 $GLOBALS['egw']->acl->add_repository($_GET['acl_app'], $location, $this->account_id, $total_rights); 123 } 124 else // we dont need to save 0 rights (= no restrictions) 125 { 126 $GLOBALS['egw']->acl->delete_repository($_GET['acl_app'], $location, $this->account_id); 127 } 128 } 129 $this->list_apps(); 130 return; 131 } 132 $GLOBALS['egw']->hooks->single('acl_manager',$_GET['acl_app']); 133 $acl_manager = $GLOBALS['acl_manager'][$_GET['acl_app']][$location]; 134 135 $this->common_header(); 136 $this->template->set_file('form','acl_manager_form.tpl'); 137 138 $acc =& CreateObject('phpgwapi.accounts',$this->account_id); 139 $acc->read_repository(); 140 $afn = $GLOBALS['egw']->common->display_fullname($acc->data['account_lid'],$acc->data['firstname'],$acc->data['lastname']); 141 142 $this->template->set_var('lang_message',lang('Check items to <b>%1</b> to %2 for %3',lang($acl_manager['name']),$GLOBALS['egw_info']['apps'][$_GET['acl_app']]['title'],$afn)); 143 $link_values = array( 144 'menuaction' => 'admin.uiaclmanager.access_form', 145 'acl_app' => $_GET['acl_app'], 146 'location' => urlencode($_GET['location']), 147 'account_id' => $this->account_id 148 ); 149 150 $acl =& CreateObject('phpgwapi.acl',$this->account_id); 151 $acl->read_repository(); 152 $grants = $acl->get_rights($location,$_GET['acl_app']); 153 154 $this->template->set_var('form_action',$GLOBALS['egw']->link('/index.php',$link_values)); 155 156 $total = 0; 157 foreach($acl_manager['rights'] as $name => $value) 158 { 159 $cb .= '<input type="checkbox" name="acl_rights[]" value="'.$value.'"'.($grants & $value ? ' checked' : '').'> '.lang($name)."<br>\n"; 160 } 161 $this->template->set_var('select_values',$cb); 162 $this->template->set_var('lang_submit',lang('Save')); 163 $this->template->set_var('lang_cancel',lang('Cancel')); 164 165 $this->template->pfp('out','form'); 166 } 167 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |