*
* Copyright 2004, GForge, LLC
* Copyright 2009-2010, Roland Mas
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-require "PFO-RBAC.interface.php";
+require 'PFO-RBAC.interface.php';
define ('USE_PFO_RBAC', true);
'docman' => array (0, 1, 2, 3, 4),
'frs' => array (0, 1, 2, 3),
-// 'webcal' => array(0, 1, 2),
);
// Global permissions
'new_tracker' => 15,
'pm_admin' => 1,
'new_pm' => 7,
- 'webcal' => 2,
),
'Senior Developer' => array( 'project_read' => 1,
'frs' => 2,
'new_tracker' => 15,
'pm_admin' => 1,
'new_pm' => 7,
- 'webcal' => 2,
),
'Junior Developer' => array( 'project_read' => 1,
'frs' => 2,
'new_forum' => 3,
'new_tracker' => 11,
'new_pm' => 3,
- 'webcal' => 2,
),
'Doc Writer' => array( 'project_read' => 1,
'frs' => 2,
'new_forum' => 3,
'new_tracker' => 9,
'new_pm' => 1,
- 'webcal' => 2,
),
'Support Tech' => array( 'project_read' => 1,
'frs' => 2,
'new_tracker' => 11,
'pm_admin' => 1,
'new_pm' => 7,
- 'webcal' => 2,
),
);
}
$section,
$reference,
$value)) ;
+ $this->perms_array[$section][$reference] = $value;
}
function getSettingsForProject ($project) {
$sections = array_merge($sections, $sections_forum);
$ff = new ForumFactory ($project) ;
- $fids = $ff->getAllForumIds () ;
+ $fids = $ff->getAllForumIdsWithNews () ;
foreach ($fids as $fid) {
$result['forum'][$fid] = $this->getVal ('forum', $fid) ;
}
return $result ;
}
- /**
- * TODO: Enter description here ...
- * @param unknown_type $section
- * @param unknown_type $reference
- * @return number|boolean
- */
- function getSetting($section, $reference) {
- $r = $this->getSettingRaw($section, $reference);
- if ($r == NULL) {
- return 0;
- }
- return $r;
- }
-
- function getSettingRaw($section, $reference) {
- if (isset ($this->perms_array[$section][$reference])) {
- $value = $this->perms_array[$section][$reference] ;
- } else {
- $value = 0 ;
+ /**
+ * TODO: Enter description here ...
+ * @param unknown_type $section
+ * @param unknown_type $reference
+ * @return number|boolean
+ */
+ function getSetting($section, $reference) {
+ $value = $this->getSettingRaw($section, $reference);
+ if ($value == NULL) {
+ $value = 0;
}
+
$min = PHP_INT_MAX ;
$mask = 0 ;
}
}
+ function getSettingRaw($section, $reference) {
+ if (isset ($this->perms_array[$section][$reference])) {
+ return $this->perms_array[$section][$reference] ;
+ }
+ }
+
/**
* getVal - get a value out of the array of settings for this role.
*
db_begin () ;
// Remove obsolete project-wide settings
- $sections = array ('project_read', 'project_admin', 'frs', 'scm', 'docman', 'tracker_admin', 'new_tracker', 'forum_admin', 'new_forum', 'pm_admin', 'new_pm', 'webcal') ;
+ $sections = array ('project_read', 'project_admin', 'frs', 'scm', 'docman', 'tracker_admin', 'new_tracker', 'forum_admin', 'new_forum', 'pm_admin', 'new_pm') ;
db_query_params ('DELETE FROM pfo_role_setting where role_id=$1 AND section_name=ANY($2) and ref_id NOT IN (SELECT home_group_id FROM pfo_role WHERE role_id=$1 AND home_group_id IS NOT NULL UNION SELECT group_id from role_project_refs WHERE role_id=$1)',
array ($this->getID(),
db_string_array_to_any_clause($sections))) ;
// Add missing settings
// ...project-wide settings
- $arr = array ('project_read', 'project_admin', 'frs', 'scm', 'docman', 'tracker_admin', 'new_tracker', 'forum_admin', 'new_forum', 'pm_admin', 'new_pm', 'webcal') ;
+ $arr = array ('project_read', 'project_admin', 'frs', 'scm', 'docman', 'tracker_admin', 'new_tracker', 'forum_admin', 'new_forum', 'pm_admin', 'new_pm') ;
foreach ($projects as $p) {
foreach ($arr as $section) {
$this->normalizePermsForSection ($new_pa, $section, $p->getID()) ;
$new_pa['forum'] = array () ;
foreach ($projects as $p) {
$ff = new ForumFactory ($p) ;
- $fids = $ff->getAllForumIds () ;
+ $fids = $ff->getAllForumIdsWithNews () ;
foreach ($fids as $fid) {
if (array_key_exists ('forum', $this->perms_array)
&& array_key_exists ($fid, $this->perms_array['forum']) ) {
// mode: php
// c-file-style: "bsd"
// End:
-
-?>