db_begin();
+ $role_id = $this->getID () ;
+
if ($role_name != $this->getName()) {
$this->setName($role_name) ;
}
+
+ $res = db_query_params ('DELETE FROM pfo_role_setting WHERE role_id=$1',
+ array ($role_id)) ;
+ $res = db_prepare ('INSERT INTO pfo_role_setting (role_id, section_name, ref_id, perm_val) VALUES ($1, $2, $3, $4)',
+ 'insert_into_pfo_role_setting');
+
foreach ($data as $sect => $refs) {
foreach ($refs as $refid => $value) {
- $this->setSetting ($sect, $refid, $value) ;
+ $res = db_execute ('insert_into_pfo_role_setting',
+ array ($role_id,
+ $sect,
+ $refid,
+ $value)) ;
}
}
+ $res = db_unprepare ('insert_into_pfo_role_setting');
+
$hook_params = array ();
$hook_params['role'] =& $this;
$hook_params['role_id'] = $this->getID();
return true ;
}
- function normalizeDataForSection (&$new_sa, $section) {
- if (array_key_exists ($section, $this->setting_array)) {
- $new_sa[$section][0] = $this->setting_array[$section][0] ;
- } elseif (array_key_exists ($this->data_array['role_name'], $this->defaults)
- && array_key_exists ($section, $this->defaults[$this->data_array['role_name']])) {
- $new_sa[$section][0] = $this->defaults[$this->data_array['role_name']][$section] ;
- } else {
- $new_sa[$section][0] = 0 ;
- }
- return $new_sa ;
- }
-
function normalizePermsForSection (&$new_pa, $section, $refid) {
if (array_key_exists ($section, $this->perms_array)
&& array_key_exists ($refid, $this->perms_array[$section])) {
$this->fetchData ($this->getID()) ;
$projects = $this->getLinkedProjects() ;
- $new_sa = array () ;
$new_pa = array () ;
// Add missing settings
$hook_params = array ();
$hook_params['role'] =& $this;
- $hook_params['new_sa'] =& $new_sa ;
$hook_params['new_pa'] =& $new_pa ;
plugin_hook ("role_normalize", $hook_params);
// ...tracker-related settings
- $new_sa['tracker'] = array () ;
$new_pa['tracker'] = array () ;
foreach ($projects as $p) {
if (!$p->usesTracker()) {
}
// ...forum-related settings
- $new_sa['forum'] = array () ;
$new_pa['forum'] = array () ;
foreach ($projects as $p) {
if (!$p->usesForum()) {
}
// ...pm-related settings
- $new_sa['pm'] = array () ;
$new_pa['pm'] = array () ;
foreach ($projects as $p) {
if (!$p->usesPM()) {