Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
load('api', null);
require_once('./includes/functions_datastore.php');
/**
* API: Usergroup
*
* @author Blue Static
* @copyright Copyright ©2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
*
*/
class UsergroupAPI extends API
{
/**
* Fields
* @var array
* @access private
*/
var $fields = array(
'usergroupid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'),
'title' => array(TYPE_STR, REQ_YES, 'verify_noempty'),
'displaytitle' => array(TYPE_STR, REQ_NO),
'permissions' => array(TYPE_UINT, REQ_NO)
);
/**
* Database table
* @var string
* @access private
*/
var $table = 'usergroup';
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
// ###################################################################
/**
* Post-insert
*
* @access private
*/
function post_insert()
{
build_usergroups();
}
// ###################################################################
/**
* Post-update
*
* @access private
*/
function post_update()
{
build_usergroups();
build_assignedto();
}
// ###################################################################
/**
* Pre-delete
*
* @access private
*/
function pre_delete()
{
if ($this->values['usergroupid'] < 7)
{
return _('You can\'t delete a default usergroup.');
}
}
// ###################################################################
/**
* Post-delete
*
* @access private
*/
function post_delete()
{
$this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "permission WHERE usergroupid = " . $this->values['usergroupid']);
$this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "bugfieldpermission WHERE usergroupid = " . $this->values['usergroupid']);
$this->registry->db->query("UPDATE " . TABLE_PREFIX . "user SET usergroupid = 2 WHERE usergroupid = " . $this->values['usergroupid']);
build_usergroups();
build_permissions();
build_assignedto();
}
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>