[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php |
Date: |
Mon, 23 Oct 2006 01:49:05 +0000 |
CVSROOT: /sources/phpgwapi
Module name: phpgwapi
Changes by: Dave Hall <skwashd> 06/10/23 01:49:05
Modified files:
inc : class.acl.inc.php
Log message:
clean up the docs a little and fix some data types
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.acl.inc.php?cvsroot=phpgwapi&r1=1.96&r2=1.97
Patches:
Index: class.acl.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.acl.inc.php,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -b -r1.96 -r1.97
--- class.acl.inc.php 22 Oct 2006 19:59:44 -0000 1.96
+++ class.acl.inc.php 23 Oct 2006 01:49:05 -0000 1.97
@@ -6,7 +6,7 @@
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General
Public License
* @package phpgwapi
* @subpackage accounts
- * @version $Id: class.acl.inc.php,v 1.96 2006/10/22 19:59:44 sigurdne
Exp $
+ * @version $Id: class.acl.inc.php,v 1.97 2006/10/23 01:49:05 skwashd
Exp $
*/
/**
@@ -57,7 +57,7 @@
* Some functions are specific to this account, and others are
generic.
* @param integer $account_id Account id
*/
- function acl($account_id = '')
+ function acl($account_id = 0)
{
$this->db =& $GLOBALS['phpgw']->db;
$this->db2 = clone($this->db);
@@ -182,11 +182,10 @@
* @param integer $rights Access rights in bitmask form
* @return array Array with ACL records
*/
- function add($appname = False, $location, $rights, $grantor =
False, $type = False)
+ function add($appname = '', $location, $rights, $grantor =
False, $type = False)
{
- if ($appname == False)
+ if ($appname == '')
{
- settype($appname,'string');
$appname =
$GLOBALS['phpgw_info']['flags']['currentapp'];
}
$this->data[$this->account_id][] = array('appname' =>
$appname, 'location' => $location, 'account' => $this->account_id, 'rights' =>
$rights, 'grantor' => $grantor, 'type' => $type);
@@ -242,13 +241,14 @@
*
* @param string|boolean $appname Application name, defaults to
false which means $GLOBALS['phpgw_info']['flags']['currentapp']
* @param string $location Application location
+ * @param ??? $grantor ask sigurd
+ * @paran ??? $type ask sigurd
* @return array Array with ACL records
*/
- function delete($appname = False, $location, $grantor = False,
$type = False)
+ function delete($appname = '', $location, $grantor = False,
$type = False)
{
- if ($appname == False)
+ if ($appname == '')
{
- settype($appname,'string');
$appname =
$GLOBALS['phpgw_info']['flags']['currentapp'];
}
if(isset($this->data[$this->account_id]) &&
is_array($this->data[$this->account_id]))
@@ -270,14 +270,14 @@
/**
* Save repository in database
*
+ * @param ??? $appname ask sigurd
+ * @param ??? $location ask sigurd
* @return array Array with ACL records
*/
-
- function save_repository($appname = False, $location='')
+ function save_repository($appname = '', $location='')
{
- if ($appname == False)
+ if ($appname == '')
{
- settype($appname,'string');
$appname =
$GLOBALS['phpgw_info']['flags']['currentapp'];
}
@@ -403,9 +403,12 @@
*
* @param $location Application location
* @param string|boolean $appname Application name, defaults to
false which means $GLOBALS['phpgw_info']['flags']['currentapp']
+ * @param ??? $grantor ask sigurd
+ * @param ??? $type ask sigurd
+ * @param ??? $account_type ask sigurd
* @return integer Access rights in bitmask form
*/
- function get_rights($location,$appname =
False,$grantor=False,$type=False,$account_type=False)
+ function get_rights($location,$appname = '', $grantor = False,
$type = False, $account_type = False)
{
// For XML-RPC, change this once its working correctly
for passing parameters (jengo)
if (is_array($location))
@@ -516,10 +519,10 @@
*
* @param string $location Application location
* @param integer $required Required right (bitmask) to check
against
- * @param string|boolean $appname Application name, defaults to
false which means $GLOBALS['phpgw_info']['flags']['currentapp']
+ * @param string $appname Application name (default empty string
is converted to false $GLOBALS['phpgw_info']['flags']['currentapp'])
* @return boolean True when $required bitmap matched otherwise
false
*/
- function check($location, $required, $appname = False)
+ function check($location, $required, $appname = '')
{
$rights = $this->check_brutto($location, $required,
$appname, false, $type=0);
$mask = $this->check_brutto($location, $required,
$appname, false, $type=1);
@@ -570,14 +573,13 @@
* Get specific rights
*
* @param string $location Application location
- * @param string|boolean $appname Application name, defaults to
false which means $GLOBALS['phpgw_info']['flags']['currentapp']
+ * @param string $appname Application name (default empty string
is converted to false $GLOBALS['phpgw_info']['flags']['currentapp'])
* @return integer Access rights in bitmask form
*/
- function get_specific_rights($location, $appname = False)
+ function get_specific_rights($location, $appname = '')
{
- if ($appname == False)
+ if ($appname == '')
{
- settype($appname,'string');
$appname =
$GLOBALS['phpgw_info']['flags']['currentapp'];
}
@@ -613,10 +615,10 @@
*
* @param string $location Application location
* @param integer $required Required rights as bitmap
- * @param string|boolean $appname Application name, defaults to
false which means $GLOBALS['phpgw_info']['flags']['currentapp']
+ * @param string $appname Application name (default empty string
is converted to false $GLOBALS['phpgw_info']['flags']['currentapp'])
* @return boolean True when $required bitmap matched otherwise
false
*/
- function check_specific($location, $required, $appname = False)
+ function check_specific($location, $required, $appname = '')
{
$rights =
$this->get_specific_rights($location,$appname);
return !!($rights & $required);
@@ -625,6 +627,8 @@
/**
* Get location list for an application with specific access
rights
*
+ * @internal imho the return on this should be an empty array
for no rights to keep the return type consistent - skwashd nov2006
+ *
* @param $app Application name
* @param integer $required Required rights as bitmap
* @return boolean|array Array with location list or false
@@ -679,7 +683,7 @@
* @param string $location Application location
* @param integer $account_id Account id
* @param integer $rights Access rights in bitmap form
- * @return boolean Always true
+ * @return boolean Always true, which seems pretty pointless
really doesn't it
*/
function add_repository($app, $location, $account_id, $rights)
{
@@ -709,10 +713,10 @@
*
* @param string $app Application name
* @param string $location Application location
- * @param integer $account_id Account id
+ * @param integer $account_id Account id - 0 = current user
* @return integer Number of deleted entries
*/
- function delete_repository($app, $location, $accountid = '')
+ function delete_repository($app, $location, $accountid = 0)
{
static $cache_accountid;
@@ -741,10 +745,10 @@
*
* @param string $location Application location
* @param integer $required Access rights as bitmap
- * @param integer $account_id Account id defaults to
$GLOBALS['phpgw_info']['user']['account_id'];
+ * @param integer $account_id Account id defaults to 0 which is
translated to $GLOBALS['phpgw_info']['user']['account_id']
* @return boolean|array Array with list of applications or false
*/
- function get_app_list_for_id($location, $required, $accountid =
'')
+ function get_app_list_for_id($location, $required, $accountid =
0 )
{
static $cache_accountid;
@@ -787,10 +791,10 @@
*
* @param string $app Application name
* @param integer $required Required access rights in bitmap form
- * @param integer $account_id Account id defaults to
$GLOBALS['phpgw_info']['user']['account_id'];
+ * @param integer $account_id Account id defaults to 0 which
translates to $GLOBALS['phpgw_info']['user']['account_id']
* @return array|boolean Array with location list or false
*/
- function get_location_list_for_id($app, $required, $accountid =
'')
+ function get_location_list_for_id($app, $required, $accountid =
0)
{
static $cache_accountid;
@@ -832,23 +836,18 @@
*
* @param string $location Application location
* @param integer $required Required access rights in bitmap
format
- * @param string $app Application name, defaults to
$GLOBALS['phpgw_info']['flags']['currentapp'];
- * @return array|boolean Array with account ids or false
+ * @param string $app Application name, defaults to empty string
which translates to $GLOBALS['phpgw_info']['flags']['currentapp']
+ * @return array Array with account ids
*/
- function get_ids_for_location($location, $required, $app =
False)
+ function get_ids_for_location($location, $required, $app = '')
{
- if ($app == False)
+ if ($app == '')
{
$app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
}
- $sql = "select acl_account, acl_rights from phpgw_acl
where acl_appname = '$app' and ";
- $sql .= "acl_location = '".$location."'";
+ $sql = "SELECT acl_account, acl_rights FROM phpgw_acl
WHERE acl_appname = '$app' AND acl_location = '$location'";
$this->db2->query($sql ,__LINE__,__FILE__);
- $rights = 0;
- if ($this->db2->num_rows() == 0 )
- {
- return False;
- }
+ $accounts = array();
while ($this->db2->next_record())
{
$rights = 0;
@@ -858,17 +857,16 @@
$accounts[] =
intval($this->db2->f('acl_account'));
}
}
- @reset($accounts);
return $accounts;
}
/**
* Get a list of applications a user has rights to
*
- * @param integer $account_id Account id, defaults to
$GLOBALS['phpgw_info']['user']['account_id']
+ * @param integer $account_id Account id, defaults to 0 which in
translated to $GLOBALS['phpgw_info']['user']['account_id']
* @return array|boolean Associativ array containing list of
application rights in bitmap form or false
*/
- function get_user_applications($accountid = '')
+ function get_user_applications($accountid = 0)
{
static $cache_accountid;
@@ -915,6 +913,9 @@
return $apps;
}
+ /**
+ * I do something, but I am not really sure what, maybe ask
sigurd
+ */
function get_grants($app='',$location='')
{
$grant_rights =
$this->get_grants_type($app,$location,0);
@@ -941,7 +942,7 @@
* @param string $app Application name, defaults to
$GLOBALS['phpgw_info']['flags']['currentapp']
* @param string $location location within Application name
* @param integer $type mask or right (1 means mask , 0 means
right) to check against
- * @return array Assoziativ array with granted access rights for
accounts
+ * @return array Associative array with granted access rights
for accounts
*/
function get_grants_type($app='',$location='',$type = '')
{
@@ -1204,7 +1205,6 @@
* @param string $location location within Application name
* @param integer $grantor : check if this is grants or ordinary
rights/mask
* @param integer $type mask or right (1 means mask , 0 means
right) to check against
-
* @return array Array with accounts
*/
function get_accounts_at_location($appname = '', $location ='',
$grantor=0 ,$type ='')
- [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php, Caeies, 2006/10/02
- [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php, Dave Hall, 2006/10/04
- [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php, Sigurd Nes, 2006/10/04
- [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php, Sigurd Nes, 2006/10/09
- [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php, Sigurd Nes, 2006/10/11
- [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php, Sigurd Nes, 2006/10/11
- [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php, Sigurd Nes, 2006/10/11
- [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php, Sigurd Nes, 2006/10/22
- [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php,
Dave Hall <=
- [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php, Sigurd Nes, 2006/10/23
- [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php, Dave Hall, 2006/10/23
- [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php, Sigurd Nes, 2006/10/23