This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, master has been updated
via 101a5c2e7493240cbed2dca3085f6b9105fc0f6f (commit)
via 2448cdbeea7b3c2071d96c085b1a4eb963666c7e (commit)
via 6004b593b3fd7bd9b1ef60370a611d30d0d2592f (commit)
via c5feded83b2d1986fb2c2567d98464a50be53722 (commit)
via 71c7bd52809b822ccf639bc39f5bd1e8304e35e8 (commit)
from 142f2947801b390303bc8fc6472c78c6f9894e84 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=101a5c2e7493240cbed2dca3085f6b9105fc0f6f
commit 101a5c2e7493240cbed2dca3085f6b9105fc0f6f
Author: Franck Villaume <[email protected]>
Date: Sat May 27 14:34:30 2017 +0200
forge cli: start support roles import in groupImport
diff --git a/src/bin/forge b/src/bin/forge
index ae1e20c..327a14f 100755
--- a/src/bin/forge
+++ b/src/bin/forge
@@ -195,6 +195,8 @@ class CliActions {
$localname =
str_replace(forge_get_config('data_path').'/', '', $value);
$zip->addFile($value, $localname);
$value = $localname;
+ } else {
+ $value = null;
}
}
}
@@ -392,7 +394,7 @@ class CliActions {
}
if ($group->usesNews()) {
$groupDump['news'] = array();
- $resultdb = db_query_params ('SELECT forum_id
FROM news_bytes WHERE news_bytes.group_id = $1',
+ $resultdb = db_query_params('SELECT forum_id
FROM news_bytes WHERE news_bytes.group_id = $1',
array($group_id));
$forumIds = array();
if ($resultdb && db_numrows($resultdb)) {
@@ -500,13 +502,17 @@ class CliActions {
$new_group->setAsTemplate($stream['setup']['data_array']['is_template']);
}
//add users as members to the project
- $role = new Role($new_group);
+ $defrole = new Role($new_group);
$adminperms = array('project_admin' => array
($new_group->getID() => 1));
- $default_role_id = $role->create('TOBEDELETED',
$adminperms, true);
+ $default_role_id =
(int)$defrole->create('TOBEDELETED', $adminperms, true);
if (isset($stream['setup']['membersArr']) &&
is_array($stream['setup']['membersArr'])) {
foreach ($stream['setup']['membersArr']
as $member) {
- $muid =
$this->getMappingId($member['data_array']['user_id'], 'user');
- $new_group->addUser($muid,
$default_role_id);
+ $muid =
(int)$this->getMappingId($member['data_array']['user_id'], 'user');
+ if (!$new_group->addUser($muid,
$default_role_id)) {
+ echo _('Unable to add
user to group with TOBEDELETED role')."\n";
+ db_rollback();
+ return false;
+ }
}
}
//inject trackers if any
@@ -590,16 +596,45 @@ class CliActions {
}
//add new roles and link users to roles
//delete initial default role!
-// if (isset($stream['setup']['roles']) &&
is_array($stream['setup']['roles'])) {
-// foreach($stream['setup']['roles'] as
$role_def) {
-// $role = new Role($new_group);
-// if
(!$role->create($role_def['role_name'], $perms, true)) {
-// echo
$role->getErrorMessage()."\n";
-// db_rollback();
-// return false;
-// }
-// }
-// }
+ if (isset($stream['setup']['roles']) &&
is_array($stream['setup']['roles'])) {
+ foreach($stream['setup']['roles'] as
$role_def) {
+ $role = new Role($new_group);
+ $perms = array();
+ if
(isset($role_def['data_array']['role_class']) &&
$role_def['data_array']['role_class'] == 1) {
+ if
(!$role->create($role_def['data_array']['role_name'], $perms, true)) {
+ echo
$role->getErrorMessage()."\n";
+ db_rollback();
+ return false;
+ } else {
+ if
(isset($role_def['userids']) && is_array($role_def['userids'])) {
+ foreach
($role_def['userids'] as $ruserid) {
+
$nruserid = (int)$this->getMappingId($ruserid, 'user');
+
if (!$new_group->addUser($nruserid, $role->getID())) {
+
echo _('Unable to add user to group with role')._(':
').$role_def['data_array']['role_name']."\n";
+
db_rollback();
+
return false;
+
} else {
+
echo sprintf(_('User %d added to group with role'), $nruserid)._(':
').$role_def['data_array']['role_name']."\n";
+
}
+ }
+ }
+ }
+ }
+ }
+ if
(isset($stream['setup']['membersArr']) &&
is_array($stream['setup']['membersArr'])) {
+ $userObjectArr = array();
+ foreach
($stream['setup']['membersArr'] as $member) {
+ $muid =
$this->getMappingId($member['data_array']['user_id'], 'user');
+ $userObjectArr[] =
user_get_object($muid);
+ }
+ }
+ $defrole->removeUsers($userObjectArr);
+ $defrole->delete();
+ }
+ // set the final status
+ if
(isset($stream['setup']['data_array']['status']) &&
$stream['setup']['data_array']['status'] == 'A') {
+ $new_group->approve($adminUser);
+ }
echo _('Group imported.')."\n";
db_commit();
return true;
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=2448cdbeea7b3c2071d96c085b1a4eb963666c7e
commit 2448cdbeea7b3c2071d96c085b1a4eb963666c7e
Author: Franck Villaume <[email protected]>
Date: Sat May 27 14:34:02 2017 +0200
space
diff --git a/src/common/include/RBAC.php b/src/common/include/RBAC.php
index 2c426a0..af76e29 100644
--- a/src/common/include/RBAC.php
+++ b/src/common/include/RBAC.php
@@ -962,10 +962,10 @@ abstract class BaseRole extends FFError {
$this->normalizePermsForSection ($new_pa,
$section, $p->getID()) ;
}
}
- $this->normalizePermsForSection ($new_pa, 'forge_admin', -1) ;
- $this->normalizePermsForSection ($new_pa, 'approve_projects',
-1) ;
- $this->normalizePermsForSection ($new_pa, 'approve_news', -1) ;
- $this->normalizePermsForSection ($new_pa, 'forge_stats', -1) ;
+ $this->normalizePermsForSection($new_pa, 'forge_admin', -1);
+ $this->normalizePermsForSection($new_pa, 'approve_projects',
-1);
+ $this->normalizePermsForSection($new_pa, 'approve_news', -1);
+ $this->normalizePermsForSection($new_pa, 'forge_stats', -1);
$hook_params = array ();
$hook_params['role'] =& $this;
@@ -973,11 +973,13 @@ abstract class BaseRole extends FFError {
plugin_hook ("role_normalize", $hook_params);
// ...tracker-related settings
- $new_pa['tracker'] = array () ;
+ $new_pa['tracker'] = array();
// Direct query to avoid querying each project - especially for
global roles
- foreach ($projects as $p)
+ $project_ids = array();
+ foreach ($projects as $p) {
$project_ids[] = $p->getID();
- $res = db_query_params('SELECT group_artifact_id FROM
artifact_group_list JOIN groups USING (group_id) WHERE use_tracker=1 AND
group_id=ANY($1)',
+ }
+ $res = db_query_params('SELECT group_artifact_id FROM
artifact_group_list JOIN groups USING (group_id) WHERE use_tracker = 1 AND
group_id = ANY($1)',
array(db_int_array_to_any_clause($project_ids)));
while ($row = db_fetch_array($res)) {
$tid = $row['group_artifact_id'];
@@ -1051,7 +1053,7 @@ abstract class BaseRole extends FFError {
}
}
// Save
- $this->update ($this->getName(), $new_pa, false, false) ;
+ $this->update($this->getName(), $new_pa, false, false);
return true;
}
}
@@ -1066,7 +1068,7 @@ abstract class RoleExplicit extends BaseRole implements
PFO_RoleExplicit {
public function addUsers($users) {
global $SYS;
- $ids = array () ;
+ $ids = array();
foreach ($users as $user) {
$ids[] = $user->getID();
}
@@ -1078,14 +1080,13 @@ abstract class RoleExplicit extends BaseRole implements
PFO_RoleExplicit {
return false;
}
while ($arr = db_fetch_array($res)) {
- $already_there[] = $arr['user_id'] ;
+ $already_there[] = $arr['user_id'];
}
foreach ($ids as $id) {
- if (!in_array ($id, $already_there)) {
- $res = db_query_params ('INSERT INTO
pfo_user_role (user_id, role_id) VALUES ($1, $2)',
- array ($id,
- $this->getID()))
;
+ if (!in_array($id, $already_there)) {
+ $res = db_query_params('INSERT INTO
pfo_user_role (user_id, role_id) VALUES ($1, $2)',
+ array ($id,
$this->getID()));
if (!$res) {
return false;
}
@@ -1216,22 +1217,22 @@ class RoleAnonymous extends BaseRole implements
PFO_RoleAnonymous {
return self::$_instance;
}
- public function getID () {
+ public function getID() {
return $this->_role_id;
}
- public function isPublic () {
+ public function isPublic() {
return true ;
}
- public function setPublic ($flag) {
+ public function setPublic($flag) {
throw new Exception(_('Cannot setPublic() on RoleAnonymous'));
}
- public function getHomeProject () {
+ public function getHomeProject() {
return NULL ;
}
- public function getName () {
+ public function getName() {
return _('Anonymous/not logged in');
}
- public function setName ($name) {
+ public function setName($name) {
throw new Exception(_('Cannot setName() on RoleAnonymous'));
}
}
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=6004b593b3fd7bd9b1ef60370a611d30d0d2592f
commit 6004b593b3fd7bd9b1ef60370a611d30d0d2592f
Author: Franck Villaume <[email protected]>
Date: Sat May 27 13:44:37 2017 +0200
fix PHP warning & clean-up
diff --git a/src/common/tracker/ArtifactFactory.class.php
b/src/common/tracker/ArtifactFactory.class.php
index 1a320ce..9c00e13 100644
--- a/src/common/tracker/ArtifactFactory.class.php
+++ b/src/common/tracker/ArtifactFactory.class.php
@@ -99,11 +99,10 @@ class ArtifactFactory extends FFError {
* @param int $_priority Set this param if you
want to limit to a certain priority
*/
function setup($offset, $order_col, $sort, $max_rows, $set,
$_assigned_to, $_status, $_extra_fields = array(), $_changed_from = 0,
$_last_modified_by = 0, $_priority = 0) {
-
if ((!$offset) || ($offset < 0)) {
- $this->offset=0;
+ $this->offset = 0;
} else {
- $this->offset=$offset;
+ $this->offset = $offset;
}
// $max_rows == 0 means we want all the rows
@@ -117,10 +116,10 @@ class ArtifactFactory extends FFError {
$u =& session_get_user();
}
if (!is_array($_extra_fields)) {
- $_extra_fields=array();
+ $_extra_fields = array();
}
- $_changed=0;
+ $_changed = 0;
if (!$set) {
/*
if no set is passed in, see if a preference was
set
@@ -128,44 +127,46 @@ class ArtifactFactory extends FFError {
*/
$this->query_type = '';
if (session_loggedin()) {
-
$query_id=$u->getPreference('art_query'.$this->ArtifactType->getID());
+ $query_id =
$u->getPreference('art_query'.$this->ArtifactType->getID());
if ($query_id) {
$this->query_type = 'query';
$this->query_id = $query_id;
} else {
-
$custom_pref=$u->getPreference('art_cust'.$this->ArtifactType->getID());
+ $custom_pref =
$u->getPreference('art_cust'.$this->ArtifactType->getID());
if ($custom_pref) {
//$_assigned_to.'|'.$_status.'|'.$_order_col.'|'.$_sort_ord.'|'.$_changed.'|'.serialize($_extra_fields);
$this->query_type = 'custom';
-
$pref_arr=explode('|',$custom_pref);
- $_assigned_to=$pref_arr[0];
- $_status=$pref_arr[1];
- $order_col=$pref_arr[2];
- $sort=$pref_arr[3];
- $_changed=$pref_arr[4];
+ $pref_arr =
explode('|',$custom_pref);
+ $_assigned_to = $pref_arr[0];
+ $_status = $pref_arr[1];
+ $order_col = $pref_arr[2];
+ $sort = $pref_arr[3];
+ $_changed = $pref_arr[4];
if
($this->ArtifactType->usesCustomStatuses() && isset($pref_arr[5])) {
-
$_extra_fields=unserialize($pref_arr[5]);
+ $_extra_fields =
unserialize($pref_arr[5]);
} else {
- $_status=$pref_arr[1];
+ $_status = $pref_arr[1];
}
- $set='custom';
+ $set = 'custom';
}
}
- } elseif (isset($_COOKIE["GFTrackerQuery"])) {
- $gf_tracker =
unserialize($_COOKIE["GFTrackerQuery"]);
- $query_id =
(int)$gf_tracker[$this->ArtifactType->getID()];
- if ($query_id) {
- $this->query_type = 'query';
- $this->query_id = $query_id;
+ } elseif (isset($_COOKIE['GFTrackerQuery'])) {
+ $gf_tracker =
unserialize($_COOKIE['GFTrackerQuery']);
+ if
(isset($gf_tracker[$this->ArtifactType->getID()])) {
+ $query_id =
(int)$gf_tracker[$this->ArtifactType->getID()];
+ if ($query_id) {
+ $this->query_type = 'query';
+ $this->query_id = $query_id;
+ }
}
}
if (!$this->query_type) {
- $res = db_query_params ('SELECT
artifact_query_id FROM artifact_query
- WHERE group_artifact_id=$1
- AND query_type=2',
+ $res = db_query_params('SELECT
artifact_query_id FROM artifact_query
+ WHERE
group_artifact_id=$1
+ AND query_type=2',
array($this->ArtifactType->getID()));
- if (db_numrows($res)>0) {
+ if (db_numrows($res) > 0) {
$this->query_type = 'query';
$this->query_id = db_result($res, 0,
'artifact_query_id');
}
@@ -174,26 +175,26 @@ class ArtifactFactory extends FFError {
if (!$this->query_type) {
//default to all opened
$this->query_type = 'default';
- $_assigned_to=0;
- $_status=1;
- $_changed=0;
+ $_assigned_to = 0;
+ $_status = 1;
+ $_changed = 0;
}
if ($this->query_type == 'query') {
$aq = new ArtifactQuery($this->ArtifactType,
$this->query_id);
- $this->submitted_by=$aq->getSubmitter();
- $_assigned_to=$aq->getAssignee();
- $this->last_modified_by=$aq->getLastModifier();
- $_status=$aq->getStatus();
- $_extra_fields=$aq->getExtraFields();
- $this->moddaterange = $aq->getModDateRange();
- $this->opendaterange = $aq->getOpenDateRange();
- $this->closedaterange =
$aq->getCloseDateRange();
- $this->summary = $aq->getSummary();
- $this->description = $aq->getDescription();
- $this->followups = $aq->getFollowups();
- $order_col=$aq->getSortCol();
- $sort=$aq->getSortOrd();
+ $this->submitted_by = $aq->getSubmitter();
+ $_assigned_to = $aq->getAssignee();
+ $this->last_modified_by =
$aq->getLastModifier();
+ $_status = $aq->getStatus();
+ $_extra_fields = $aq->getExtraFields();
+ $this->moddaterange =
$aq->getModDateRange();
+ $this->opendaterange =
$aq->getOpenDateRange();
+ $this->closedaterange =
$aq->getCloseDateRange();
+ $this->summary = $aq->getSummary();
+ $this->description = $aq->getDescription();
+ $this->followups = $aq->getFollowups();
+ $order_col = $aq->getSortCol();
+ $sort = $aq->getSortOrd();
}
}
@@ -201,7 +202,7 @@ class ArtifactFactory extends FFError {
// validate the column names and sort order passed in from user
// before saving it to prefs
//
- $allowed_order_col = array ('artifact_id',
+ $allowed_order_col = array('artifact_id',
'summary',
'open_date',
'close_date',
@@ -212,19 +213,17 @@ class ArtifactFactory extends FFError {
'last_modified_by',
'_votes',
'_voters',
- '_votage') ;
+ '_votage');
$efarr = $this->ArtifactType->getExtraFields();
- $keys=array_keys($efarr);
- for ($k=0; $k<count($keys); $k++) {
- $i=$keys[$k];
+ $keys = array_keys($efarr);
+ for ($k = 0; $k < count($keys); $k++) {
+ $i = $keys[$k];
$allowed_order_col[] = $efarr[$i]['extra_field_id'];
}
- $_order_col = util_ensure_value_in_set ($order_col,
- $allowed_order_col);
- $_sort_ord = util_ensure_value_in_set ($sort,
- array ('ASC', 'DESC')) ;
- if ($set=='custom') {
+ $_order_col = util_ensure_value_in_set($order_col,
$allowed_order_col);
+ $_sort_ord = util_ensure_value_in_set($sort, array('ASC',
'DESC')) ;
+ if ($set == 'custom') {
$this->query_type = 'custom';
if (session_loggedin()) {
/*
@@ -259,7 +258,7 @@ class ArtifactFactory extends FFError {
$u->deletePreference('art_query'.$this->ArtifactType->getID());
}
}
- $_changed=0;
+ $_changed = 0;
}
//ugly hack to force _changed value to parameter
if ($_changed_from) {
diff --git a/src/common/tracker/actions/browse.php
b/src/common/tracker/actions/browse.php
index 082d02e..8dca560 100644
--- a/src/common/tracker/actions/browse.php
+++ b/src/common/tracker/actions/browse.php
@@ -68,7 +68,7 @@ if (session_loggedin()) {
if($query_id) {
if ($query_id == '-1') {
- $LUSER->setPreference('art_query'.$ath->getID(),'');
+ $LUSER->setPreference('art_query'.$ath->getID(), '');
} else {
$aq = new ArtifactQuery($ath,$query_id);
if (!$aq || !is_object($aq)) {
@@ -77,7 +77,7 @@ if (session_loggedin()) {
$aq->makeDefault();
}
} else {
- $query_id= $LUSER->getPreference('art_query'.$ath->getID(),'');
+ $query_id = $LUSER->getPreference('art_query'.$ath->getID(),
'');
}
} elseif ($query_id) {
// If user is not logged, then use a cookie to store the current query.
@@ -92,7 +92,9 @@ if (session_loggedin()) {
$_COOKIE["GFTrackerQuery"] = serialize($gf_tracker);
} elseif (isset($_COOKIE["GFTrackerQuery"])) {
$gf_tracker = unserialize($_COOKIE["GFTrackerQuery"]);
- $query_id = (int)$gf_tracker[$ath->getID()];
+ if (isset($gf_tracker[$ath->getID()])) {
+ $query_id = (int)$gf_tracker[$ath->getID()];
+ }
}
if(!isset($paging) || !$paging)
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=c5feded83b2d1986fb2c2567d98464a50be53722
commit c5feded83b2d1986fb2c2567d98464a50be53722
Author: Franck Villaume <[email protected]>
Date: Sat May 27 13:28:56 2017 +0200
space
diff --git a/src/common/include/RBAC.php b/src/common/include/RBAC.php
index bf687a1..2c426a0 100644
--- a/src/common/include/RBAC.php
+++ b/src/common/include/RBAC.php
@@ -1117,40 +1117,40 @@ abstract class RoleExplicit extends BaseRole implements
PFO_RoleExplicit {
public function removeUsers($users) {
global $SYS;
- $ids = array () ;
+ $ids = array();
foreach ($users as $user) {
- $ids[] = $user->getID() ;
+ $ids[] = $user->getID();
}
- $res = db_query_params ('DELETE FROM pfo_user_role WHERE
user_id=ANY($1) AND role_id=$2',
- array
(db_int_array_to_any_clause($ids), $this->getID())) ;
+ $res = db_query_params('DELETE FROM pfo_user_role WHERE user_id
= ANY($1) AND role_id = $2',
+ array(db_int_array_to_any_clause($ids),
$this->getID()));
foreach ($this->getLinkedProjects() as $p) {
foreach ($ids as $uid) {
- $SYS->sysGroupCheckUser($p->getID(),$uid) ;
+ $SYS->sysGroupCheckUser($p->getID(), $uid);
}
}
- return true ;
+ return true;
}
public function removeUser($user) {
- if(!$this->removeUsers(array($user))){
+ if (!$this->removeUsers(array($user))) {
return false;
}
$hook_params['user'] = $user;
$hook_params['role'] = $this;
- plugin_hook ("role_removeuser", $hook_params);
+ plugin_hook("role_removeuser", $hook_params);
return true;
}
public function getUsers() {
$result = array();
- $res = db_query_params ('SELECT user_id FROM pfo_user_role
WHERE role_id=$1',
- array ($this->getID())) ;
+ $res = db_query_params('SELECT user_id FROM pfo_user_role WHERE
role_id=$1',
+ array($this->getID()));
while ($arr = db_fetch_array($res)) {
- $result[] = user_get_object ($arr['user_id']) ;
+ $result[] = user_get_object($arr['user_id']);
}
return $result;
@@ -1181,11 +1181,11 @@ class RoleAnonymous extends BaseRole implements
PFO_RoleAnonymous {
private $_role_id ;
public static function getInstance() {
if (isset(self::$_instance)) {
- return self::$_instance ;
+ return self::$_instance;
}
- $c = __CLASS__ ;
- self::$_instance = new $c ;
+ $c = __CLASS__;
+ self::$_instance = new $c;
/* drop vote rights from RoleAnonymous */
// why ?????
@@ -1200,39 +1200,39 @@ class RoleAnonymous extends BaseRole implements
PFO_RoleAnonymous {
self::$_instance->role_values[$x] = $y;
}
- $res = db_query_params ('SELECT r.role_id FROM pfo_role r,
pfo_role_class c WHERE r.role_class = c.class_id AND c.class_name = $1',
- array ('PFO_RoleAnonymous')) ;
+ $res = db_query_params('SELECT r.role_id FROM pfo_role r,
pfo_role_class c WHERE r.role_class = c.class_id AND c.class_name = $1',
+ array('PFO_RoleAnonymous')) ;
if (!$res || !db_numrows($res)) {
- throw new Exception ("No PFO_RoleAnonymous role in the
database") ;
+ throw new Exception(_('No PFO_RoleAnonymous role in the
database'));
}
self::$_instance->_role_id = db_result ($res, 0, 'role_id') ;
$hook_params = array ();
$hook_params['role'] =& self::$_instance;
- plugin_hook ("role_get", $hook_params);
+ plugin_hook ('role_get', $hook_params);
- self::$_instance->fetchData (self::$_instance->_role_id) ;
+ self::$_instance->fetchData(self::$_instance->_role_id);
- return self::$_instance ;
+ return self::$_instance;
}
public function getID () {
- return $this->_role_id ;
+ return $this->_role_id;
}
public function isPublic () {
return true ;
}
public function setPublic ($flag) {
- throw new Exception ("Can't setPublic() on RoleAnonymous") ;
+ throw new Exception(_('Cannot setPublic() on RoleAnonymous'));
}
public function getHomeProject () {
return NULL ;
}
public function getName () {
- return _('Anonymous/not logged in') ;
+ return _('Anonymous/not logged in');
}
public function setName ($name) {
- throw new Exception ("Can't setName() on RoleAnonymous") ;
+ throw new Exception(_('Cannot setName() on RoleAnonymous'));
}
}
@@ -1242,54 +1242,54 @@ class RoleLoggedIn extends BaseRole implements
PFO_RoleLoggedin {
private $_role_id ;
public static function getInstance() {
if (isset(self::$_instance)) {
- return self::$_instance ;
+ return self::$_instance;
}
- $c = __CLASS__ ;
- self::$_instance = new $c ;
+ $c = __CLASS__;
+ self::$_instance = new $c;
- $res = db_query_params ('SELECT r.role_id FROM pfo_role r,
pfo_role_class c WHERE r.role_class = c.class_id AND c.class_name = $1',
- array ('PFO_RoleLoggedIn')) ;
+ $res = db_query_params('SELECT r.role_id FROM pfo_role r,
pfo_role_class c WHERE r.role_class = c.class_id AND c.class_name = $1',
+ array ('PFO_RoleLoggedIn'));
if (!$res || !db_numrows($res)) {
- throw new Exception ("No PFO_RoleLoggedIn role in the
database") ;
+ throw new Exception(_('No PFO_RoleLoggedIn role in the
database'));
}
- self::$_instance->_role_id = db_result ($res, 0, 'role_id') ;
+ self::$_instance->_role_id = db_result ($res, 0, 'role_id');
$hook_params = array ();
$hook_params['role'] =& self::$_instance;
- plugin_hook ("role_get", $hook_params);
+ plugin_hook ('role_get', $hook_params);
- self::$_instance->fetchData (self::$_instance->_role_id) ;
+ self::$_instance->fetchData (self::$_instance->_role_id);
- return self::$_instance ;
+ return self::$_instance;
}
- public function getID () {
- return $this->_role_id ;
+ public function getID() {
+ return $this->_role_id;
}
- public function isPublic () {
- return true ;
+ public function isPublic() {
+ return true;
}
public function setPublic ($flag) {
- throw new Exception ("Can't setPublic() on RoleLoggedIn") ;
+ throw new Exception(_('Cannot setPublic() on RoleLoggedIn'));
}
- public function getHomeProject () {
- return NULL ;
+ public function getHomeProject() {
+ return NULL;
}
- public function getName () {
- return _('Any user logged in') ;
+ public function getName() {
+ return _('Any user logged in');
}
- public function setName ($name) {
- throw new Exception ("Can't setName() on RoleLoggedIn") ;
+ public function setName($name) {
+ throw new Exception(_('Cannot setName() on RoleLoggedIn'));
}
}
abstract class RoleUnion extends BaseRole implements PFO_RoleUnion {
- public function addRole ($role) {
- throw new Exception ("Not implemented") ;
+ public function addRole($role) {
+ throw new Exception(_('Not implemented'));
}
- public function removeRole ($role) {
- throw new Exception ("Not implemented") ;
+ public function removeRole($role) {
+ throw new Exception(_('Not implemented'));
}
}
@@ -1298,39 +1298,39 @@ abstract class RoleUnion extends BaseRole implements
PFO_RoleUnion {
*
*/
class RoleComparator {
- var $criterion = 'composite' ;
- var $reference_project = NULL ;
+ var $criterion = 'composite';
+ var $reference_project = NULL;
function Compare ($a, $b) {
switch ($this->criterion) {
case 'name':
- return strcoll ($a->getName(), $b->getName()) ;
+ return strcoll ($a->getName(), $b->getName());
break ;
case 'id':
- $aid = $a->getID() ;
- $bid = $b->getID() ;
+ $aid = $a->getID();
+ $bid = $b->getID();
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
- break ;
+ break;
case 'composite':
default:
if ($this->reference_project == NULL) {
- return $this->CompareNoRef ($a, $b) ;
+ return $this->CompareNoRef ($a, $b);
}
- $rpid = $this->reference_project->getID () ;
- $ap = $a->getHomeProject() ;
- $bp = $b->getHomeProject() ;
- $a_is_local = ($ap != NULL && $ap->getID() == $rpid) ;
// Local
- $b_is_local = ($bp != NULL && $bp->getID() == $rpid) ;
+ $rpid = $this->reference_project->getID();
+ $ap = $a->getHomeProject();
+ $bp = $b->getHomeProject();
+ $a_is_local = ($ap != NULL && $ap->getID() == $rpid);
// Local
+ $b_is_local = ($bp != NULL && $bp->getID() == $rpid);
if ($a_is_local && !$b_is_local) {
- return -1 ;
+ return -1;
} elseif (!$a_is_local && $b_is_local) {
- return 1 ;
+ return 1;
}
- return $this->CompareNoRef ($a, $b) ;
+ return $this->CompareNoRef ($a, $b);
}
}
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=71c7bd52809b822ccf639bc39f5bd1e8304e35e8
commit 71c7bd52809b822ccf639bc39f5bd1e8304e35e8
Author: Franck Villaume <[email protected]>
Date: Sat May 27 12:30:49 2017 +0200
space
diff --git a/src/common/include/RBAC.php b/src/common/include/RBAC.php
index b726808..bf687a1 100644
--- a/src/common/include/RBAC.php
+++ b/src/common/include/RBAC.php
@@ -1103,8 +1103,8 @@ abstract class RoleExplicit extends BaseRole implements
PFO_RoleExplicit {
return true;
}
- public function addUser ($user) {
- if (!$this->addUsers (array ($user))) {
+ public function addUser($user) {
+ if (!$this->addUsers(array($user))) {
return false;
}
$hook_params['user'] = $user;
@@ -1134,8 +1134,8 @@ abstract class RoleExplicit extends BaseRole implements
PFO_RoleExplicit {
return true ;
}
- public function removeUser ($user) {
- if(!$this->removeUsers (array ($user))){
+ public function removeUser($user) {
+ if(!$this->removeUsers(array($user))){
return false;
}
$hook_params['user'] = $user;
@@ -1146,23 +1146,23 @@ abstract class RoleExplicit extends BaseRole implements
PFO_RoleExplicit {
}
public function getUsers() {
- $result = array () ;
+ $result = array();
$res = db_query_params ('SELECT user_id FROM pfo_user_role
WHERE role_id=$1',
array ($this->getID())) ;
while ($arr = db_fetch_array($res)) {
$result[] = user_get_object ($arr['user_id']) ;
}
- return $result ;
+ return $result;
}
public function hasUser($user) {
- $res = db_query_params ('SELECT user_id FROM pfo_user_role
WHERE user_id=$1 AND role_id=$2',
- array ($user->getID(), $this->getID()))
;
+ $res = db_query_params('SELECT user_id FROM pfo_user_role WHERE
user_id=$1 AND role_id=$2',
+ array($user->getID(), $this->getID()));
if ($res && db_numrows($res)) {
- return true ;
+ return true;
} else {
- return false ;
+ return false;
}
}
-----------------------------------------------------------------------
Summary of changes:
src/bin/forge | 65 +++++++---
src/common/include/RBAC.php | 187 ++++++++++++++-------------
src/common/tracker/ArtifactFactory.class.php | 105 ++++++++-------
src/common/tracker/actions/browse.php | 8 +-
4 files changed, 201 insertions(+), 164 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits