From 3a81d8234ae0df5368f73e9e3e152cf0b97711d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20Wei=C3=9F?= Date: Sun, 20 Feb 2005 14:41:52 +0000 Subject: [PATCH] add direct booking to acl --- resources/inc/class.bo_acl.inc.php | 14 +++++++++----- resources/inc/class.ui_acl.inc.php | 8 +++++--- resources/templates/default/acl.tpl | 6 ++++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/resources/inc/class.bo_acl.inc.php b/resources/inc/class.bo_acl.inc.php index 3edec3d9b5..0e7cbec264 100755 --- a/resources/inc/class.bo_acl.inc.php +++ b/resources/inc/class.bo_acl.inc.php @@ -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ß @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); diff --git a/resources/inc/class.ui_acl.inc.php b/resources/inc/class.ui_acl.inc.php index 44d08ff9df..38ea9d7f54 100755 --- a/resources/inc/class.ui_acl.inc.php +++ b/resources/inc/class.ui_acl.inc.php @@ -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); } diff --git a/resources/templates/default/acl.tpl b/resources/templates/default/acl.tpl index d41ecedb31..9c28948a8d 100755 --- a/resources/templates/default/acl.tpl +++ b/resources/templates/default/acl.tpl @@ -24,9 +24,10 @@
- + + @@ -36,10 +37,11 @@ + -
{sort_cat}{sort_cat} {lang_read} {lang_write}
({lang_implies})
{lang_book}
+