View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
04180Bug reportsSurvey editingpublic2010-03-24 10:48
Reporterthone Assigned Totexens  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Product Version1.87+ 
Summary04180: Add group to a survey
Description

I have a group of two users. I tried to add this group to a survey, I got result page with "blank" message and no user got added. If I manually added one user in this group, and try to add group, the other user was added successfully.

Steps To Reproduce

1) Create a survey using UserA
2) Create two new user UserB and UserC who have all permissions except "Super User"
3) Create a new group (Group1) and add UserB and UserC to this group
4) Back to the survey, security setting, add Group1.

TagsNo tags attached.
Attached Files
limesurvey_img.gif (71,658 bytes)   
limesurvey_img.gif (71,658 bytes)   
html.php.patch (1,796 bytes)   
Index: html.php
===================================================================
--- html.php	(revision 8515)
+++ html.php	(working copy)
@@ -1626,16 +1626,14 @@
 			{
 				while ($row2 = $result2->FetchRow())
 				{
-					$uid_arr[] = $row2['uid'];
-					$values[] = "($surveyid, {$row2['uid']},0,0,0,0,0,0)";
-				}
-				$values_implode = implode(",", $values);
+                    $uid_arr[] = $row2['uid'];
+                    $isrquery = "INSERT INTO {$dbprefix}surveys_rights VALUES ($surveyid, {$row2['uid']},0,0,0,0,0,0) ";
+                    $isrresult = $connect->Execute($isrquery); //Checked
+                    if (!$isrresult) break;
+                }
 
-				$isrquery = "INSERT INTO {$dbprefix}surveys_rights VALUES ".$values_implode;
-				$isrresult = $connect->Execute($isrquery); //Checked
-
-				if($isrresult)
-				{
+                if($isrresult)
+                {
 					$addsummary .= "<div class=\"successheader\">".$clang->gT("User Group added.")."</div>\n";
 					$_SESSION['uids'] = $uid_arr;
 					$addsummary .= "<br /><form method='post' action='$scriptname?sid={$surveyid}'>"
@@ -1643,7 +1641,13 @@
 					."<input type='hidden' name='action' value='setusergroupsurveysecurity' />"
 					."<input type='hidden' name='ugid' value='{$postusergroupid}' />"
 					."</form>\n";
-				}
+                }
+                else
+                {
+                // Error while adding user to the database
+                $addsummary .= "<div class=\"warningheader\">".$clang->gT("Failed to add User Group.")."</div>\n";
+                $addsummary .= "<br/><input type=\"submit\" onclick=\"window.open('$scriptname?action=surveysecurity&amp;sid={$surveyid}', '_top')\" value=\"".$clang->gT("Continue")."\"/>\n";
+                }
 			}
 			else
 			{
html.php.patch (1,796 bytes)   
Bug heat8
Complete LimeSurvey version number (& build)8429
I will donate to the project if issue is resolved
BrowserChrome
Database type & versionSQL Server Express 2005
Server OS (if known)Windows XP
Webserver software & version (if known)IIS 5.0
PHP Version5.2.8

Users monitoring this issue

There are no users monitoring this issue.

Activities

texens

texens

2010-03-05 06:10

reporter   ~11217

thone,
You might have set display_errors to Off in your php.ini files, and perhaps that is why you are getting a blank page instead of any warnings. It would be easier to debug if you could set the display_errors to On in your php.ini file and post the errors.

Mazi

Mazi

2010-03-05 11:41

updater   ~11218

If possible also take a look at your servers error log and add the details here.

Mazi

Mazi

2010-03-05 11:47

updater   ~11219

Hey texens, can you take a look at it? We really need some help at fixing bugs.

If there are any questions please ask at our developer IRC.

thone

thone

2010-03-05 19:21

reporter   ~11236

Hello,
I have display_error on. It doesn't seem to be a totally blank page. It is actually Limesurvey message page with "blank" message. I am posting image.

texens

texens

2010-03-08 18:31

reporter   ~11253

Last edited: 2010-03-08 18:33

Unable to reproduce the bug.

@thone, I'm mentioning the steps that I took while attempting to reproduce the bug. Kindly take a look at it and let me know if your path differs from mine at any step.

Step – 1: Logged in as admin, click on edit users, and create user A
Step – 2: Set user rights of A to be all except Super Administrator
Step – 3: Logged in as UserA, create a survey – named Test Survey
Step – 4: Logged in as admin, Add UserB and UserC, and then set their user rights to all except super Administrator
Step – 5: Logged in as admin, create a new group named Test Group
Step – 6: Logged in as admin, add UserB and UserC to the Test Group
Step – 7: Logged in as admin, click on Survey Security Setting
Step – 8: The user group added notice comes up on screen. And a button is displayed to set survey rights.

PS: Logged in as admin, means that the action is performed by the admin.
PPS: Assuming all the actions (except creating Test Survey) like creating the userB, userC and Test Group was done by the admin and not the UserA.

c_schmitz

c_schmitz

2010-03-15 22:53

administrator   ~11377

Thone, can you please provide feedback? Otherwise we have to close this issue.

thone

thone

2010-03-16 01:37

reporter   ~11382

Thank you all for working on this ticket.

Yes, the steps texens are taking are correct way of reproducing the problem on my system. The problem may happen because of I am testing the software on Windows XP and using MS SQL Server Express. I was about to try this on our development server (win 2003) which have 1.80+ installed but my manager told me to put limesurvey upgrade project on hold therefore I cannot do anything further.

Please close the ticket at your convenient.

Thanks a lot.

c_schmitz

c_schmitz

2010-03-16 01:42

administrator   ~11383

texens, did you test this on MSSQL server?

c_schmitz

c_schmitz

2010-03-22 17:56

administrator   ~11470

Reminder sent to: texens

What is the status on this?

texens

texens

2010-03-23 00:59

reporter   ~11478

tested it on MS SQL Server Express 2005 and have been able to reproduce the error.
I'm looking into the code to find the cause.

texens

texens

2010-03-23 07:52

reporter   ~11480

The error was caused because MS SQL server Express 2005 does not support inserting more than one row using only one insert statement of the form :
"INSERT INTO table VALUES (set 1), (set 2), (set 3)"

The workaround is
"INSERT INTO table SELECT set1
UNION ALL
SELECT set2
UNION ALL
SELECT set3

texens

texens

2010-03-23 08:25

reporter   ~11481

Fix committed to r8512.

c_schmitz

c_schmitz

2010-03-23 10:11

administrator   ~11482

Hi texens,

although your solution works you are not solving the basic problem.
Why not change the function so that there are just multiple inserts used?
Because you don't know now if the problem still exists in PostgreSQL - if you take the basic route you know it is solved on all databases. Avoid db-specific solutions.

texens

texens

2010-03-23 16:18

reporter   ~11487

Fix committed to r8516.

Removed the db-specific solution.

  • Added multiple insert statements for adding users (one insert statement for each user in the group).
  • Displaying error if database update operation fails due to any reason, so that it doesn't show a confusing output(as in the screen-shot attached by thone)
thone

thone

2010-03-23 18:01

reporter   ~11488

Thanks guys. You guys are awesome!

c_schmitz

c_schmitz

2010-03-23 20:23

administrator   ~11489

Thank you, texens!

Issue History

Date Modified Username Field Change
2010-03-05 00:17 thone New Issue
2010-03-05 06:10 texens Note Added: 11217
2010-03-05 11:41 Mazi Note Added: 11218
2010-03-05 11:41 Mazi Assigned To => Mazi
2010-03-05 11:41 Mazi Status new => feedback
2010-03-05 11:46 Mazi Status feedback => assigned
2010-03-05 11:46 Mazi Assigned To Mazi => texens
2010-03-05 11:47 Mazi Note Added: 11219
2010-03-05 19:21 thone Note Added: 11236
2010-03-05 19:35 thone File Added: limesurvey_img.gif
2010-03-08 18:31 texens Note Added: 11253
2010-03-08 18:33 texens Note Edited: 11253
2010-03-08 18:34 texens Assigned To texens =>
2010-03-08 18:34 texens Assigned To => texens
2010-03-08 22:50 Mazi Status assigned => feedback
2010-03-10 21:37 texens Assigned To texens =>
2010-03-10 21:38 texens Status feedback => assigned
2010-03-10 21:38 texens Assigned To => texens
2010-03-10 21:39 texens Status assigned => feedback
2010-03-15 22:53 c_schmitz Note Added: 11377
2010-03-16 01:37 thone Note Added: 11382
2010-03-16 01:37 thone Status feedback => assigned
2010-03-16 01:42 c_schmitz Note Added: 11383
2010-03-22 17:56 c_schmitz Note Added: 11470
2010-03-23 00:59 texens Note Added: 11478
2010-03-23 00:59 texens Status assigned => confirmed
2010-03-23 01:00 texens Status confirmed => assigned
2010-03-23 07:48 texens File Added: html.php.patch
2010-03-23 07:52 texens Note Added: 11480
2010-03-23 08:25 texens Note Added: 11481
2010-03-23 08:25 texens Status assigned => resolved
2010-03-23 08:25 texens Resolution open => fixed
2010-03-23 10:11 c_schmitz Note Added: 11482
2010-03-23 10:11 c_schmitz Status resolved => feedback
2010-03-23 10:11 c_schmitz Resolution fixed => reopened
2010-03-23 15:58 texens File Deleted: html.php.patch
2010-03-23 15:59 texens File Added: html.php.patch
2010-03-23 16:18 texens Note Added: 11487
2010-03-23 16:18 texens Status feedback => resolved
2010-03-23 16:18 texens Resolution reopened => fixed
2010-03-23 18:01 thone Note Added: 11488
2010-03-23 20:23 c_schmitz Note Added: 11489
2010-03-24 10:48 c_schmitz Status resolved => closed
2010-10-25 00:17 c_schmitz Category Survey Design => Survey design
2019-11-01 17:25 c_schmitz Category Survey design => Survey editing