[Fusionforge-general] Information: Group->create function: drop of is_public parameter

Franck Villaume franck.villaume at trivialdev.com
Mon May 8 16:58:52 CEST 2017


Hi all,

the following commit removed the old and obsolete is_public parameter 
from the create function of Group.class.php
Please update your code if you are running master code and specific 
homebrew feature relying on this function.

Best,

Franck aka nerville



-------- Message transféré --------
Sujet : 	[Fusionforge-commits] FusionForge branch master updated. 
v6.0.5-1790-ga7e31ec
Date : 	Mon, 08 May 2017 16:55:40 +0200
De : 	Franck Villaume <nerville at libremir.placard.fr.eu.org>
Répondre à : 	fusionforge-general at lists.fusionforge.org
Pour : 	fusionforge-commits at lists.fusionforge.org



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  a7e31ec6cdd48256b5802f3b1eff88b1b20fb01b (commit)
       from  7b56f136fca4a8c118849cb6f56645b7a4fe2911 (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=a7e31ec6cdd48256b5802f3b1eff88b1b20fb01b

commit a7e31ec6cdd48256b5802f3b1eff88b1b20fb01b
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Mon May 8 16:54:17 2017 +0200

     Group create function: drop obsolete is_public parameter

diff --git a/src/bin/forge b/src/bin/forge
index 07294eb..7342b80 100755
--- a/src/bin/forge
+++ b/src/bin/forge
@@ -466,7 +466,7 @@ class CliActions {
  				$createtimestamp = null;
  			}
  			if (!$new_group->create($adminUser, $stream['setup']['data_array']['group_name'], $stream['setup']['data_array']['unix_group_name'], $stream['setup']['data_array']['short_description'], $stream['setup']['data_array']['register_purpose'], $unix_box,
-				$scm_box, false, false, 0, $createtimestamp)) {
+				$scm_box, false, 0, $createtimestamp)) {
  				echo $new_group->getErrorMessage()."\n";
  				db_rollback();
  				return false;
diff --git a/src/bin/inject-groups.php b/src/bin/inject-groups.php
index 8df58df..980183e 100755
--- a/src/bin/inject-groups.php
+++ b/src/bin/inject-groups.php
@@ -26,9 +26,8 @@ db_begin ();
  
  /*
   * Line format:
- * unixname:fullname:description:ispublic:username
+ * unixname:fullname:description:username
   * username is login of admin user
- * ispublic is 0/1
   * Beware of colons in text fields (fullname, description)!
  */
  
@@ -37,21 +36,20 @@ while (! feof ($f)) {
  	$l = trim (fgets ($f, 1024)) ;
  	if ($l == "") { continue ; } ;
  	$array = explode (':', $l) ;
-	$unixname = $array[0] ;
-	$fullname = $array[1] ;
-	$description = $array[2] ;
-	$is_public = $array[3] ;
-	$username = $array[4] ;
+	$unixname = $array[0];
+	$fullname = $array[1];
+	$description = $array[2];
+	$username = $array[3];
  
-	$u = user_get_object_by_name($username) ;
+	$u = user_get_object_by_name($username);
  	if (! $u) {
  		print "Error: invalid user\n" ;
-		db_rollback () ;
-		exit (1) ;
+		db_rollback();
+		exit(1);
  	}
  
-	$g = new Group () ;
-	$r = $g->create ($u, $fullname, $unixname, $description, 'Project injected into the database by inject-groups.php', 'shell', 'scm', $is_public, false) ;
+	$g = new Group();
+	$r = $g->create($u, $fullname, $unixname, $description, 'Project injected into the database by inject-groups.php', 'shell', 'scm', false);
  
  	if (!$r) {
  		print "Error: ". $g->getErrorMessage () . "\n" ;
diff --git a/src/common/include/Group.class.php b/src/common/include/Group.class.php
index 9b92f9d..6d784bd 100644
--- a/src/common/include/Group.class.php
+++ b/src/common/include/Group.class.php
@@ -319,14 +319,13 @@ class Group extends FFError {
  	 * @param	string	$purpose		The purpose of the group.
  	 * @param	string	$unix_box
  	 * @param	string	$scm_box
-	 * @param	bool	$is_public		///TODO: obsolete, do delete.
  	 * @param	bool	$send_mail		Whether to send an email or not
  	 * @param	int	$built_from_template	The id of the project this new project is based on
  	 * @param	int	$createtimestamp	The Time Stamp of creation to ease import.
  	 * @return	bool	success or not
  	 */
  	function create(&$user, $group_name, $unix_name, $description, $purpose, $unix_box = 'shell1',
-			$scm_box = 'cvs1', $is_public = true, $send_mail = true, $built_from_template = 0, $createtimestamp = null) {
+			$scm_box = 'cvs1', $send_mail = true, $built_from_template = 0, $createtimestamp = null) {
  		// $user is ignored - anyone can create pending group
  
  		global $SYS;
diff --git a/src/plugins/projectimport/www/projectsimport.php b/src/plugins/projectimport/www/projectsimport.php
index 03ba414..25af027 100644
--- a/src/plugins/projectimport/www/projectsimport.php
+++ b/src/plugins/projectimport/www/projectsimport.php
@@ -234,7 +234,6 @@ class ProjectsImportPage extends FileManagerPage {
  					$description = $project->getDescription();
  					$purpose = 'Imported from JSON file';
  					$scm_host = '';
-					$is_public = $project->getIsPublic();
  					$send_mail = ! forge_get_config ('project_auto_approval') ;
  					$built_from_template = 0 ;
  
@@ -248,7 +247,6 @@ class ProjectsImportPage extends FileManagerPage {
  						$purpose,
  						'shell1',
  						$scm_host,
-						$is_public,
  						$send_mail,
  						$built_from_template);
  
@@ -273,7 +271,6 @@ class ProjectsImportPage extends FileManagerPage {
  
  					$htmlcontent .= '<p>full_name : '. $full_name .'</p>';
  					//$html .= '<p>purpose : '. $project->getPurpose() .'</p>';
-					$htmlcontent .= '<p>is_public : '. $is_public .'</p>';
  					$htmlcontent .= '</td></tr>';
  
  				}
diff --git a/src/utils/inject-ctf-project-forklift-format.php b/src/utils/inject-ctf-project-forklift-format.php
index 867069c..3b8c5e2 100755
--- a/src/utils/inject-ctf-project-forklift-format.php
+++ b/src/utils/inject-ctf-project-forklift-format.php
@@ -119,7 +119,7 @@ if (is_dir($project_path.'/project')) {
  				$fullname = substr($fullname, 0, MAXSIZE__GROUP_PROJECTNAME);
  			}
  			$description = trim((string)$simpleXmlLoadedFile->description);
-			$is_public = trim((string)$simpleXmlLoadedFile['accessLevel']);
+			//$is_public = trim((string)$simpleXmlLoadedFile['accessLevel']); <= to reuse to link anonymous access?
  			$username = trim((string)$simpleXmlLoadedFile->createdByUsername);
  			$ctfxid = trim((string)$simpleXmlLoadedFile['xid']);
  			$status = trim((string)$simpleXmlLoadedFile->status);
@@ -138,7 +138,7 @@ if (is_dir($project_path.'/project')) {
  			// now create the Group in DB
  			$g = new Group();
  			$r = $g->create($ctfUser, $fullname, $unixname, $description, 'Project injected into the database using CTF forklift XML export',
-					'shell', 'scm', $is_public, false);
+					'shell', 'scm', 0);
  
  			if (!$r) {
  				echo 'Error: '.$g->getErrorMessage()."\n";
diff --git a/src/www/register/index.php b/src/www/register/index.php
index 7e5733d..713508a 100644
--- a/src/www/register/index.php
+++ b/src/www/register/index.php
@@ -120,7 +120,6 @@ if (getStringFromRequest('submit')) {
  		$purpose,
  		'shell1',
  		$scm_host,
-		0,
  		$send_mail,
  		$built_from_template
  	);
diff --git a/src/www/soap/common/group.php b/src/www/soap/common/group.php
index 5a82218..8c91344 100644
--- a/src/www/soap/common/group.php
+++ b/src/www/soap/common/group.php
@@ -152,7 +152,7 @@ $server->register(
  	$uri.'#approveGroup', 'rpc', 'encoded'
  );
  
-//addGroup ($user, $group_name, $unix_name, $description, $purpose, $unix_box = 'shell1', $scm_box = 'cvs1', $is_public = 1, $send_mail = true, $built_from_template = 0)
+//addGroup ($user, $group_name, $unix_name, $description, $purpose, $unix_box = 'shell1', $scm_box = 'cvs1', $send_mail = true, $built_from_template = 0)
  $server->register(
  	'addGroup',
  	array('session_ser' => 'xsd:string',
@@ -162,7 +162,6 @@ $server->register(
  		'purpose' => 'xsd:string',
  		'unix_box' => 'xsd:string',
  		'scm_box' => 'xsd:string',
-		'is_public' => 'xsd:int',
  		'send_mail' => 'xsd:boolean',
  		'built_from_template' => 'xsd:int'),
  	array('return' => 'xsd:boolean'),
@@ -395,11 +394,11 @@ function approveGroup($session_ser, $group_id) {
  }
  
  // add a group
-function addGroup($session_ser, $group_name, $unix_name, $description, $purpose, $unix_box, $scm_box, $is_public, $send_mail, $built_from_template) {
+function addGroup($session_ser, $group_name, $unix_name, $description, $purpose, $unix_box, $scm_box, $send_mail, $built_from_template) {
  	continue_session($session_ser);
  	$group = new Group();
  	$u = session_get_user();
-	$result = $group->create($u, $group_name, $unix_name, $description, $purpose, $unix_box, $scm_box, $is_public, $send_mail, $built_from_template);
+	$result = $group->create($u, $group_name, $unix_name, $description, $purpose, $unix_box, $scm_box, $send_mail, $built_from_template);
  
  	if (!$result) {
  		$errMsg = 'Could Not Add A New Project: '.$group->getErrorMessage();

-----------------------------------------------------------------------

Summary of changes:
  src/bin/forge                                    |  2 +-
  src/bin/inject-groups.php                        | 22 ++++++++++------------
  src/common/include/Group.class.php               |  3 +--
  src/plugins/projectimport/www/projectsimport.php |  3 ---
  src/utils/inject-ctf-project-forklift-format.php |  4 ++--
  src/www/register/index.php                       |  1 -
  src/www/soap/common/group.php                    |  7 +++----
  7 files changed, 17 insertions(+), 25 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
Fusionforge-commits at lists.fusionforge.org
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits


-- 
TrivialDev Founder
http://trivialdev.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: franck_villaume.vcf
Type: text/x-vcard
Size: 211 bytes
Desc: not available
URL: <http://lists.fusionforge.org/pipermail/fusionforge-general/attachments/20170508/f463535b/attachment.vcf>


More information about the Fusionforge-general mailing list