add direct booking to acl

This commit is contained in:
Cornelius Weiß 2005-02-20 14:41:52 +00:00
parent 9317f4e7bb
commit 3a81d8234a
3 changed files with 18 additions and 10 deletions

View File

@ -10,8 +10,6 @@
* -------------------------------------------- *
\**************************************************************************/
/* $Id: */
class bo_acl
{
/*! @var $permissions Holds alls permissions for resources of user */
@ -30,6 +28,10 @@
function bo_acl($session=False)
{
define('PHPGW_ACL_CAT_ADMIN',64);
define('PHPGW_ACL_DIRECT_BOOKING',128);
// define('PHPGW_ACL_CUSTOM_3',256);
$this->so = CreateObject('resources.so_acl');
$this->permissions = $this->so->get_permissions($GLOBALS['phpgw_info']['user']['account_id'],true);
@ -59,8 +61,8 @@
}
/*!
@function get_readcats
@abstract get list of readable cats for current user
@function get_cats
@abstract get list of cats where current user has given rights
@author Cornelius Weiß <egw@von-und-zu-weiss.de>
@param int $perm_type one of PHPGW_ACL_READ, PHPGW_ACL_ADD, PHPGW_ACL_EDIT, PHPGW_ACL_DELETE
@return array cat_name => cat_id
@ -124,10 +126,11 @@
return $this->is_permitted($cat_id,PHPGW_ACL_ADD);
}
function set_rights($cat_id,$read,$write)
function set_rights($cat_id,$read,$write,$book)
{
$readcat = $read ? $read : array();
$writecat = $write ? $write : array();
$bookcat = $book ? $book : array();
$this->so->remove_location('L' . $cat_id);
reset($this->accounts);
@ -138,6 +141,7 @@
$rights = in_array($account_id,$writecat) ?
(PHPGW_ACL_READ | PHPGW_ACL_ADD | PHPGW_ACL_EDIT | PHPGW_ACL_DELETE) :
(in_array($account_id,$readcat) ? PHPGW_ACL_READ : False);
$rights = in_array($account_id,$bookcat) ? ($rights | PHPGW_ACL_DIRECT_BOOKING) : $rights;
if ($rights)
{
$GLOBALS['phpgw']->acl->add_repository('resources','L'.$cat_id,$account_id,$rights);

View File

@ -11,7 +11,7 @@
\**************************************************************************/
/* $Id$ */
class ui_acl
{
var $start = 0;
@ -57,7 +57,7 @@
{
foreach($_POST['catids'] as $cat_id)
{
$this->bo->set_rights($cat_id,$_POST['inputread'][$cat_id],$_POST['inputwrite'][$cat_id]);
$this->bo->set_rights($cat_id,$_POST['inputread'][$cat_id],$_POST['inputwrite'][$cat_id],$_POST['inputbook'][$cat_id]);
}
}
@ -71,6 +71,7 @@
'lang_read' => lang('Read permissions'),
'lang_write' => lang('Write permissions'),
'lang_implies' => lang('implies read permission'),
'lang_book' => lang('Direct booking permissions'),
));
$left = $this->nextmatchs->left('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=resources.uiacl.acllist');
@ -98,7 +99,8 @@
'catname' => $cat['name'],
'catid' => $cat['id'],
'read' => $this->selectlist(PHPGW_ACL_READ),
'write' => $this->selectlist(PHPGW_ACL_ADD)
'write' => $this->selectlist(PHPGW_ACL_ADD),
'book' =>$this->selectlist(PHPGW_ACL_DIRECT_BOOKING)
));
$GLOBALS['phpgw']->template->parse('Cblock','cat_list',True);
}

View File

@ -24,9 +24,10 @@
<form method="POST">
<table border="0" cellspacing="2" cellpadding="2" width="60%">
<tr bgcolor="{th_bg}" valign="middle" align="center">
<td>{sort_cat}</td>
<td>{sort_cat}</td>
<td>{lang_read}</td>
<td>{lang_write}<br>({lang_implies})</td>
<td>{lang_book}</td>
</tr>
<!-- BEGIN cat_list -->
<tr bgcolor="{tr_color}">
@ -36,10 +37,11 @@
</td>
<td align="center"><select multiple="multiple" size="5" name="inputread[{catid}][]">{read}</select></td>
<td align="center"><select multiple="multiple" size="5" name="inputwrite[{catid}][]">{write}</select></td>
<td align="center"><select multiple="multiple" size="5" name="inputbook[{catid}][]">{book}</select></td>
</tr>
<!-- END cat_list -->
<tr>
<td colspan="3" align="center">
<td colspan="4" align="center">
<input type="submit" name="btnSave" value="{lang_save}"> &nbsp;
<input type="submit" name="btnDone" value="{lang_done}">
</td>