Added new ACL Manager, currently only user accounts is using it

This commit is contained in:
jengo 2001-09-04 01:12:13 +00:00
parent ac6cb8b252
commit 0b5c0c040a
12 changed files with 408 additions and 74 deletions

View File

@ -113,6 +113,11 @@
function list_users($param_cd='') function list_users($param_cd='')
{ {
if ($GLOBALS['phpgw']->acl->check('account_access',1,'admin'))
{
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/admin/index.php'));
}
if(!$param_cd) if(!$param_cd)
{ {
$cd = $param_cd; $cd = $param_cd;
@ -151,11 +156,20 @@
'lang_view' => lang('view'), 'lang_view' => lang('view'),
'actionurl' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.add_user'), 'actionurl' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.add_user'),
'accounts_url' => $url, 'accounts_url' => $url,
'lang_add' => lang('add'),
'lang_search' => lang('search') 'lang_search' => lang('search')
); );
$p->set_var($var); $p->set_var($var);
if (! $GLOBALS['phpgw']->acl->check('account_access',4,'admin'))
{
$p->set_var('input_add','<input type="submit" value="' . lang('Add') . '">');
}
if (! $GLOBALS['phpgw']->acl->check('account_access',2,'admin'))
{
$p->set_var('input_search',lang('Search') . '&nbsp;<input name="query">');
}
$account_info = $GLOBALS['phpgw']->accounts->get_list('accounts',$start,$sort,$order,$query); $account_info = $GLOBALS['phpgw']->accounts->get_list('accounts',$start,$sort,$order,$query);
if (! count($account_info)) if (! count($account_info))
@ -165,23 +179,62 @@
} }
else else
{ {
if (! $GLOBALS['phpgw']->acl->check('account_access',8,'admin'))
{
$can_view = True;
}
if (! $GLOBALS['phpgw']->acl->check('account_access',16,'admin'))
{
$can_edit = True;
}
if (! $GLOBALS['phpgw']->acl->check('account_access',32,'admin'))
{
$can_delete = True;
}
while (list($null,$account) = each($account_info)) while (list($null,$account) = each($account_info))
{ {
$this->nextmatchs->template_alternate_row_color($p); $this->nextmatchs->template_alternate_row_color($p);
$var = Array( $var = array(
'row_loginid' => $account['account_lid'], 'row_loginid' => $account['account_lid'],
'row_firstname' => (!$account['account_firstname']?'&nbsp':$account['account_firstname']), 'row_firstname' => (!$account['account_firstname']?'&nbsp':$account['account_firstname']),
'row_lastname' => (!$account['account_lastname']?'&nbsp':$account['account_lastname']), 'row_lastname' => (!$account['account_lastname']?'&nbsp':$account['account_lastname'])
'row_edit' => $this->row_action('edit','user',$account['account_id']),
'row_delete' => ($GLOBALS['phpgw_info']['user']['userid'] != $account['account_lid']?$this->row_action('delete','user',$account['account_id']):'&nbsp'),
'row_view' => $this->row_action('view','user',$account['account_id'])
); );
$p->set_var($var); $p->set_var($var);
if ($can_edit)
{
$p->set_var('row_edit',$this->row_action('edit','user',$account['account_id']));
}
else
{
$p->set_var('row_edit','&nbsp;');
}
if ($can_delete)
{
$p->set_var('row_delete',($GLOBALS['phpgw_info']['user']['userid'] != $account['account_lid']?$this->row_action('delete','user',$account['account_id']):'&nbsp'));
}
else
{
$p->set_var('row_delete','&nbsp;');
}
if ($can_view)
{
$p->set_var('row_view',$this->row_action('view','user',$account['account_id']));
}
else
{
$p->set_var('row_view','&nbsp;');
}
$p->parse('rows','row',True); $p->parse('rows','row',True);
} }
} // End else } // End else
$p->pparse('out','list'); $p->pfp('out','list');
} }
function add_group() function add_group()
@ -196,9 +249,16 @@
} }
function add_user() function add_user()
{
if ($GLOBALS['phpgw']->acl->check('account_access',4,'admin'))
{
$this->list_users();
}
else
{ {
$this->create_edit_user(0); $this->create_edit_user(0);
} }
}
function delete_group() function delete_group()
{ {
@ -276,11 +336,10 @@
function delete_user() function delete_user()
{ {
if ($GLOBALS['phpgw']->acl->check('account_access',32,'admin') || $GLOBALS['phpgw_info']['user']['account_id'] == $GLOBALS['HTTP_GET_VARS']['account_id'])
if($GLOBALS['phpgw_info']['user']['account_id'] == $GLOBALS['HTTP_GET_VARS']['account_id'])
{ {
Header('Location: '.$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_users')); $this->list_users();
$GLOBALS['phpgw']->common->phpgw_exit(); return False;
} }
unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['noheader']);
@ -348,6 +407,12 @@
function edit_user($cd='',$account_id='') function edit_user($cd='',$account_id='')
{ {
if ($GLOBALS['phpgw']->acl->check('account_access',16,'admin'))
{
$this->list_users();
return False;
}
$cdid = $cd; $cdid = $cd;
settype($cd,'integer'); settype($cd,'integer');
$cd = ($GLOBALS['HTTP_GET_VARS']['cd']?$GLOBALS['HTTP_GET_VARS']['cd']:intval($cdid)); $cd = ($GLOBALS['HTTP_GET_VARS']['cd']?$GLOBALS['HTTP_GET_VARS']['cd']:intval($cdid));
@ -360,7 +425,8 @@
// not needed if i use the same file for new users too // not needed if i use the same file for new users too
if (! $account_id) if (! $account_id)
{ {
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_users')); $this->list_users();
return False;
} }
else else
{ {
@ -370,9 +436,10 @@
function view_user() function view_user()
{ {
if (!$GLOBALS['HTTP_GET_VARS']['account_id']) if ($GLOBALS['phpgw']->acl->check('account_access',8,'admin') || ! $GLOBALS['HTTP_GET_VARS']['account_id'])
{ {
Header('Location: ' . $phpgw->link('/index.php','menuaction=admin.uiaccounts.list_users')); $this->list_users();
return False;
} }
unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']);

View File

@ -38,7 +38,7 @@
} }
// $file must be in the following format: // $file must be in the following format:
// $file = Array( // $file = array(
// 'Login History' => array('/index.php','menuaction=admin.uiaccess_history.list') // 'Login History' => array('/index.php','menuaction=admin.uiaccess_history.list')
// ); // );
// This allows extra data to be sent along // This allows extra data to be sent along
@ -65,7 +65,8 @@
$this->t->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']); $this->t->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
$this->t->set_var('link_done',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_users')); $this->t->set_var('link_done',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_users'));
$this->t->set_var('lang_done',lang('back')); $this->t->set_var('lang_done',lang('Back'));
$this->t->set_var('row_on',$this->rowColor[0]); $this->t->set_var('row_on',$this->rowColor[0]);
$this->t->parse('out','menu_links'); $this->t->parse('out','menu_links');
@ -79,17 +80,15 @@
switch ($_hookname) switch ($_hookname)
{ {
case 'edit_user': case 'edit_user':
$GLOBALS['menuData'][] = Array $GLOBALS['menuData'][] = array(
( 'description' => 'User Data',
'description' => 'userdata',
'url' => '/index.php', 'url' => '/index.php',
'extradata' => 'menuaction=admin.uiaccounts.edit_user' 'extradata' => 'menuaction=admin.uiaccounts.edit_user'
); );
break; break;
case 'view_user': case 'view_user':
$GLOBALS['menuData'][] = Array $GLOBALS['menuData'][] = array(
( 'description' => 'User Data',
'description' => 'userdata',
'url' => '/index.php', 'url' => '/index.php',
'extradata' => 'menuaction=admin.uiaccounts.view_user' 'extradata' => 'menuaction=admin.uiaccounts.view_user'
); );

View File

@ -0,0 +1,96 @@
<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$GLOBALS['acl_manager']['admin']['site_config_access'] = array(
'name' => 'Deny to site configuration',
'rights' => array(
'List config settings' => 1,
'Change config settings' => 2
)
);
$GLOBALS['acl_manager']['admin']['account_access'] = array(
'name' => 'Deny access to user accounts',
'rights' => array(
'Account list' => 1,
'Search accounts' => 2,
'Add account' => 4,
'View account' => 8,
'Edit account' => 16,
'Delete account' => 32,
)
);
$GLOBALS['acl_manager']['admin']['group_access'] = array(
'name' => 'Deny access to groups',
'rights' => array(
'Group list' => 1,
'Search groups' => 2,
'Add group' => 4,
'View group' => 8,
'Edit group' => 16,
'Delete group' => 32
)
);
$GLOBALS['acl_manager']['admin']['peer_server_access'] = array(
'name' => 'Deny access to peer servers',
'rights' => array(
'Peer server list' => 1,
'Search peer servers' => 2,
'Add peer server' => 4,
'View peer server' => 8,
'Edit peer server' => 16,
'Delete peer server' => 32
)
);
$GLOBALS['acl_manager']['admin']['applications_access'] = array(
'name' => 'Deny access to applications',
'rights' => array(
'Applications list' => 1,
'Add application' => 2,
'Edit application' => 4,
'Delete application' => 8
)
);
$GLOBALS['acl_manager']['admin']['global_categories_access'] = array(
'name' => 'Deny access to global categories',
'rights' => array(
'Categories list' => 1,
'Search categories' => 2,
'Add category' => 4,
'View category' => 8,
'Edit category' => 16,
'Delete category' => 32
)
);
$GLOBALS['acl_manager']['admin']['mainscreen_message_access'] = array(
'name' => 'Deny access to mainscreen message',
'rights' => array(
'Main screen message' => 1,
'Login message' => 2
)
);
$GLOBALS['acl_manager']['admin']['current_sessions_access'] = array(
'name' => 'Deny access to current sessions',
'rights' => array(
'List current sessions' => 1,
'Show current action' => 2,
'Show session IP address' => 4,
'Kill session' => 8
)
);

View File

@ -11,19 +11,50 @@
/* $Id$ */ /* $Id$ */
$file = array( if (! $GLOBALS['phpgw']->acl->check('site_config_access',1,'admin'))
'Site Configuration' => $phpgw->link('/admin/config.php','appname=admin'), {
'Peer Servers' => $phpgw->link('/admin/servers.php'), $file['Site Configuration'] = $phpgw->link('/admin/config.php','appname=admin');
'User Accounts' => $phpgw->link('/index.php','menuaction=admin.uiaccounts.list_users'), }
'User Groups' => $phpgw->link('/index.php','menuaction=admin.uiaccounts.list_groups'),
'Applications' => $phpgw->link('/admin/applications.php'), if (! $GLOBALS['phpgw']->acl->check('peer_server_access',1,'admin'))
'Global Categories' => $phpgw->link('/admin/categories.php'), {
'Change Main Screen Message' => $phpgw->link('/admin/mainscreen_message.php'), $file['Peer Servers'] = $phpgw->link('/admin/servers.php');
'View Sessions' => $phpgw->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions'), }
'View Access Log' => $phpgw->link('/index.php','menuaction=admin.uiaccess_history.list_history'),
'View Error Log' => $phpgw->link('/admin/log.php'), if (! $GLOBALS['phpgw']->acl->check('account_access',1,'admin'))
'phpInfo' => $phpgw->link('/admin/phpinfo.php') {
); $file['User Accounts'] = $phpgw->link('/index.php','menuaction=admin.uiaccounts.list_users');
}
if (! $GLOBALS['phpgw']->acl->check('group_access',1,'admin'))
{
$file['User Groups'] = $phpgw->link('/index.php','menuaction=admin.uiaccounts.list_groups');
}
if (! $GLOBALS['phpgw']->acl->check('applications_access',1,'admin'))
{
$file['Applications'] = $phpgw->link('/admin/applications.php');
}
if (! $GLOBALS['phpgw']->acl->check('global_categories_access',1,'admin'))
{
$file['Global Categories'] = $phpgw->link('/admin/categories.php');
}
if (! $GLOBALS['phpgw']->acl->check('mainscreen_message_access',1,'admin'))
{
$file['Change Main Screen Message'] = $phpgw->link('/admin/mainscreen_message.php');
}
if (! $GLOBALS['phpgw']->acl->check('current_sessions_access',1,'admin'))
{
$file['View Sessions'] = $phpgw->link('/index.php','menuaction=admin.uicurrentsessions.list_sessions');
}
// These need to be added still
$file['View Access Log'] = $phpgw->link('/index.php','menuaction=admin.uiaccess_history.list_history');
$file['View Error Log'] = $phpgw->link('/admin/log.php');
$file['phpInfo'] = $phpgw->link('/admin/phpinfo.php');
//Do not modify below this line //Do not modify below this line
display_section('admin','admin',$file); display_section('admin','admin',$file);

View File

@ -0,0 +1,30 @@
<?php
/**************************************************************************\
* phpGroupWare - Administration *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$GLOBALS['menuData'][] = array(
'description' => 'Login History',
'url' => '/index.php',
'extradata' => 'menuaction=admin.uiaccess_history.list_history'
);
$GLOBALS['menuData'][] = array(
'description' => 'ACL Rights',
'url' => '/index.php',
'extradata' => 'menuaction=admin.uiaclmanager.list_apps'
);
//Do not modify below this line
// global $menuData;
// $GLOBALS['menuData'][] = $data;
?>

View File

@ -1,12 +1,25 @@
<?php <?php
// Only Modify the $file and $title variables..... /**************************************************************************\
$data = Array * phpGroupWare - Administration *
( * http://www.phpgroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$GLOBALS['menuData'][] = array(
'description' => 'Login History', 'description' => 'Login History',
'url' => '/index.php', 'url' => '/index.php',
'extradata' => 'menuaction=admin.uiaccess_history.list_history' 'extradata' => 'menuaction=admin.uiaccess_history.list_history'
); );
//Do not modify below this line $GLOBALS['menuData'][] = array(
$GLOBALS['menuData'][] = $data; 'description' => 'ACL Rights',
'url' => '/index.php',
'extradata' => 'menuaction=admin.uiaclmanager.list_apps'
);
?> ?>

View File

@ -5,8 +5,10 @@
<center> <center>
<table border="0" width="95%"> <table border="0" width="95%">
<tr> <tr>
<td valign="top">
{rows} {rows}
<td> </td>
<td valign="top">
<table border=0 width=100%> <table border=0 width=100%>
<tr bgcolor="{th_bg}"> <tr bgcolor="{th_bg}">
@ -32,9 +34,7 @@
<tr bgcolor="{tr_color2}"> <tr bgcolor="{tr_color2}">
<td>{lang_groups}</td> <td>{lang_groups}</td>
<td>{groups_select}&nbsp;</td> <td colspan="3">{groups_select}&nbsp;</td>
<td>{lang_file_space}</td>
<td>{account_file_space}{account_file_space_select}</td>
</tr> </tr>
<tr bgcolor="{tr_color1}"> <tr bgcolor="{tr_color1}">

View File

@ -28,12 +28,12 @@
<table border="0" width="70%" align="center"> <table border="0" width="70%" align="center">
<tr> <tr>
<td align="left"> <td align="left">
<input type="submit" value="{lang_add}"></form> {input_add}
</form>
</td> </td>
<td align="right"> <td align="right">
<form method="POST" action="{accounts_url}"> <form method="POST" action="{accounts_url}">
{lang_search}&nbsp; {input_search}
<input name="query">
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -0,0 +1,53 @@
<!-- BEGIN list -->
<b>{lang_header}</b>
<hr><p>
<table border="0" width="70%" align="center">
<tr>
<td align="left">{left_next_matchs}</td>
<td width="95%" align="center">&nbsp;</td>
<td align="right">{right_next_matchs}</td>
</tr>
</table>
<center>
<table border="0" width="70%">
<tr bgcolor="{th_bg}">
<td>{lang_loginid}</td>
<td>{lang_lastname}</td>
<td>{lang_firstname}</td>
<td>{lang_access}</td>
</tr>
{rows}
</table>
</center>
<form method="POST" action="{actionurl}">
<table border="0" width="70%" align="center">
<tr>
<td align="right">
<form method="POST" action="{accounts_url}">
<input name="query" value="{lang_search}">
</form>
</td>
</tr>
</table>
<!-- END list -->
<!-- BEGIN row -->
<tr bgcolor="{tr_color}">
<td>{row_loginid}</td>
<td>{row_lastname}</td>
<td>{row_firstname}</td>
<td width="5%">{row_access}</td>
</tr>
<!-- END row -->
<!-- BEGIN row_empty -->
<tr>
<td colspan="5" align="center">{message}</td>
</tr>
<!-- END row_empty -->

View File

@ -0,0 +1,33 @@
<!-- BEGIN list -->
<b>{lang_header}</b>
<hr><p>
<table width="75%" border="0" cellspacing="0" cellpadding="0">
{rows}
</table>
<!-- END list -->
<!-- BEGIN app_row -->
<tr bgcolor="{icon_backcolor}">
<td width="5%" valign="middle"><img src="{app_icon}" alt="[ {app_name} ]"> <a name="{a_name}"></a></td>
<td width="95%" valign="middle"><strong>&nbsp;&nbsp;{app_name}</strong></td>
</tr>
<!-- END app_row -->
<!-- BEGIN app_row_noicon -->
<tr bgcolor="{icon_backcolor}">
<td colspan="2" width="95%" valign="middle"><strong>&nbsp;&nbsp;{app_name}</strong> <a name="{a_name}"></a></td>
</tr>
<!-- END app_row_noicon -->
<!-- BEGIN link_row -->
<tr>
<td colspan="2">&nbsp;&#8226;&nbsp;<a href="{link_location}">{lang_location}</a></td>
</tr>
<!-- END link_row -->
<!-- BEGIN spacer_row -->
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<!-- END spacer_row -->

View File

@ -0,0 +1,20 @@
<!-- BEGIN form -->
<b>{lang_title}</b>
<hr><p>
<form method="POST" action="{form_action}">
<table border="0" width="60%" cellspacing="5" cellpadding="5">
<tr>
<td colspan="2">{lang_message}</td>
</tr>
<tr>
<td colspan="2">{select_values}</td>
</tr>
<tr>
<td align="left"><input type="submit" name="submit" value="{lang_submit}"></td>
<td align="left"><input type="submit" name="cancel" value="{lang_cancel}"></td>
</tr>
</table>
</form>
<!-- END form -->

View File

@ -1,27 +1,19 @@
<!-- BEGIN menu_links --> <!-- BEGIN menu_links -->
<td valign="top" width="140">
<table border="0" width="100%"> <table border="0" width="100%">
<tr bgcolor="{th_bg}"> <tr bgcolor="{th_bg}">
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
{all_rows} {all_rows}
<tr> <tr>
<td> <td>&nbsp;</td>
&nbsp;
</td>
</tr> </tr>
<tr> <tr>
<td bgcolor="{row_on}"> <td bgcolor="{row_on}">&nbsp;&nbsp;<a href="{link_done}">{lang_done}</a></td>
&nbsp;&nbsp;<a href="{link_done}">{lang_done}</a>
</td>
</tr> </tr>
</table> </table>
</td>
<!-- END menu_links --> <!-- END menu_links -->
<!-- BEGIN link_row --> <!-- BEGIN link_row -->
<tr bgcolor="{tr_color}"> <tr bgcolor="{tr_color}">
<td colspan="2">&nbsp;&nbsp;<a href="{row_link}">{row_text}</a></td> <td>&nbsp;&nbsp;<a href="{row_link}">{row_text}</a></td>
</tr> </tr>
<!-- END link_row --> <!-- END link_row -->