Project

General

Profile

Where/when is the myamiweb administrator account created?

Added by Patrick Goetz about 7 years ago

Using the myami-mysqlupdate branch of trunk, I'm now able to get to Database Initialization, Step 3 : Insert Default Values.

However clicking through this results in an error screen:

Error: Create administrator user first

At no step during the myamiweb setup was I asked to create an administrator account. Oddly, we were asked for this information prior to version 2 if myami-mysqlupdate.

Now I'm stuck again, because it's not clear how to set up the administrator account.

Also, I checked in mysql, and the necessary tables in leginondb and projectdb were created


Replies (11)

RE: Where/when is the myamiweb administrator account created? - Added by Patrick Goetz about 7 years ago

This item doesn't seem to be getting any attention. I can try debugging this myself, but it would be helpful to know at what stage of the process am I supposed to be asked to set an administrative myamiweb password.

RE: Where/when is the myamiweb administrator account created? - Added by Anchi Cheng about 7 years ago

Tracing the code is the easiest to find what is wrong. Each of the wizard page executes what it is made to do and redirect to the next page if it is error free. Since you are at step 3, looking at insertInitData.php, It only ask for administrator values

<?php if(empty($has_errors)){ ?>

The other possibility is that you had a half set-up database table. Specifically, it would not get to the part asking for the administrator information to insert if it detects that project database has the initialization table, and has content.

If something went wrong in the middle of the setup wizard and you need to rerun setup wizard, please drop all tables in bother leginon and project database so that they are both empty. You can keep config.php when you rerun as long as you intend to use the same values in that.

RE: Where/when is the myamiweb administrator account created? - Added by Patrick Goetz about 7 years ago

I've dropped all the DB tables a few times, already, but did so again in the interest of tracking down this problem:

mysql> use leginondb;
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> use projectdb;
Database changed
mysql> show tables;
Empty set (0.00 sec)

Starting from this URL: http://kraken.biosci.utexas.edu/myamiweb/setup/

The first PHP wizard page is setupBase.php, which automatically sets some default values
Second PHP wizard page is setupEmail.php -- unless cookie passphrase = administrator password, there's nothing here
Third PHP wizard page is setupDatabase.php -- sets up databases and DB user
Fourth PHP wizard page is setupOthers.php -- I don't see anything here, either
Fifth PHP wizard page is setupProcessingHosts.php -- I just clicked "Next" for now.
Sixth PHP wizard page is confirmConfig.php -- this just summarized previously entered valued in preparation for creating config.php
Seventh PHP wizard page is review.php -- this provides contents of config.php and a button to initialize the databases
Eighth PHP wizard page is initDBTables.php -- provides an initialize DBs button
Ninth PHP wizard page is initTablesReport.php, which shows the list of tables that have been created:

'projectdb' contains the following tables

boxtypes
confirmauth
dataStatusReport
gridboxes
gridlocations
grids
install
privileges
processingdb
projectexperiments
projectowners
projects
shareexperiments
userdetails

'leginondb' contains the following tables

AcquisitionSettingsData
AlignmentManagerSettingsData
ApplicationData
BeamFixerSettingsData
BeamTiltCalibratorSettingsData
BeamTiltFixerSettingsData
BeamTiltImagerSettingsData
BindingSpecData
BlobFinderSettingsData
CameraSettingsData
CenterTargetFilterSettingsData
ClickTargetFinderSettingsData
CorrectorSettingsData
DTFinderSettingsData
DoseCalibratorSettingsData
ExposureFixerSettingsData
FocusSequenceData
FocusSettingData
FocuserSettingsData
GonModelerSettingsData
GridEntrySettingsData
GroupData
HoleFinderSettingsData
ImageCommentData
InstrumentData
JAHCFinderSettingsData
LaunchedApplicationData
LowPassFilterSettingsData
MatrixCalibratorSettingsData
MosaicClickTargetFinderSettingsData
MosaicTargetMakerSettingsData
NavigatorSettingsData
NodeSpecData
PixelSizeCalibratorSettingsData
PresetsManagerSettingsData
RCTAcquisitionSettingsData
RasterFinderSettingsData
RasterTargetFilterSettingsData
RobotSettingsData
SessionData
SetupWizardSettingsData
TiltRotateSettingsData
TomographySettingsData
TransformManagerSettingsData
UserData
ViewerImageStatus
viewer_cache
viewer_comment
viewer_del_image
viewer_login
viewer_pref_image
viewer_update
viewer_users 

Tenth PHP wizard page is insertInitData.php -- which is the Step 3 asking for an administrative password.

Nowhere in this sequence did I see an opportunity to set a password for the myamiweb administrator. We tried the DB user (usr_object) password, but this didn't work.

RE: Where/when is the myamiweb administrator account created? - Added by Anchi Cheng about 7 years ago

What does insertInitData.php page look like if it does not ask for myamiweb administrator information ? This page is where you set it. It can not do it earlier because tables are not initialized. Maybe the wording in this page is confusing ?

Check if leginondb.UserData table exists, field defined and is empty at this point.

Check if projectdb.install table exists and is empty at this point

Once you click next button in this page, after entering the password you want to set for this administrator user, it should redirect you to updateDataReport.php and both tables, and many others have entries.

RE: Where/when is the myamiweb administrator account created? - Added by Patrick Goetz about 7 years ago

It looks like a password has already been set in leginondb.UserData at this point (i.e. after entering information in Step 3, clicking Next and getting

Error: Create administrator user first

on the initDataReport.php screen.

mysql> use leginondb;
Database changed
mysql> select * from UserData;
+--------+---------------------+---------------+----------------+---------------+----------------------------------+--------------------+---------------------+-----------+----------+
| DEF_id | DEF_timestamp       | username      | firstname      | lastname      | password                         | email              | REF|GroupData|group | noleginon | advanced |
+--------+---------------------+---------------+----------------+---------------+----------------------------------+--------------------+---------------------+-----------+----------+
|      1 | 2017-11-13 14:10:09 | administrator | Appion-Leginon | Administrator | 12760dc4e1357b9ca745eb02c460e1cd | dtaylor@utexas.edu |                   1 |         0 |        1 |
|      2 | 2017-11-13 14:10:09 | anonymous     | Public         | User          | 294de3557d9d00b3d2d8a1e6aab028cf | dtaylor@utexas.edu |                   4 |         1 |        0 |
+--------+---------------------+---------------+----------------+---------------+----------------------------------+--------------------+---------------------+-----------+----------+
2 rows in set (0.00 sec)

The install table in projectdb also seems to be populated with stuff as well:

mysql> use projectdb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from install;
+----------+-------+
| key      | value |
+----------+-------+
| settable | 1     |
| version  | trunk |
| revision | 19429 |
| settable | 1     |
| version  | trunk |
| revision | 19429 |
+----------+-------+
6 rows in set (0.01 sec)

As far as I tell it's inserting the values into leginondb.UserData and then getting back this strange error from Mysql (see above). This based on Step 4 is in initDataReport.php, but it doesn't actually get to this step before I get to the error message.

RE: Where/when is the myamiweb administrator account created? - Added by Anchi Cheng about 7 years ago

It looks like this is a mysqli query problem since the information did get inserted. That message comes from a failed query of administrator user DEF_id. Let me dive into it.

RE: Where/when is the myamiweb administrator account created? - Added by Anchi Cheng about 7 years ago

I could not reproduc it, but here is a crude test php script that you can put in your myamiweb directory and run it to see what it says. My result looks like this:

query is: SELECT `DEF_id` from `UserData` where `username` like "administrator" or "Administrator" Result is string(1) "1" 

The erro message you got is from when Result is empty (null or 0 or empty string).

RE: Where/when is the myamiweb administrator account created? - Added by Patrick Goetz about 7 years ago

Yep, that replicated the result I was getting. Running testSetUserid.php, I get

query is: SELECT `DEF_id` from `UserData` where `username` like "administrator" or "Administrator" Result is NULL

Error: Create administrator user first

Even though the administrator record is in the database as shown in my last comment. I have no problem running the query directly against the database:

mysql> use leginondb;
Database changed
mysql> SELECT `DEF_id` from `UserData` where `username` like "administrator" or    "Administrator";
+--------+
| DEF_id |
+--------+
|      1 |
+--------+
1 row in set, 1 warning (0.00 sec)

(BTW, you have a minor error in your SQL syntax. It should be [SELECT `DEF_id` from `UserData` where `username` like "administrator" or `username` like "Administrator";]
but really should just be [SELECT `DEF_id` from `UserData` where `username` like "administrator";] since that username is hardwired into the PHP script.

The problem seems to be in the SQLQuery() function in inc/mysql.inc. This function is called by SQLInsert() in initDataReport.php -- that's where the error is occurring.

RE: Where/when is the myamiweb administrator account created? - Added by Anchi Cheng about 7 years ago

SQLQuery called by SQLInsert() is not the problem since the insertion was fine.

SQLQuery in getSQLResult did not return mysqli object is why the returned DEF_id is null.

Since I can not reproduce it from my end, it is up to you to figure out why your mysqli behaves differently unless you give me access to your system. My mysqli is mysqlnd 5.0.11.

RE: Where/when is the myamiweb administrator account created? - Added by Patrick Goetz about 7 years ago

Issue resolved. There were still left over bugs from the PHP mysql to mysqli conversion. In particular

   function getSQLResult($query, $fetch=MYSQL_ASSOC) {

in inc/mysql.inc should have been

   function getSQLResult($query, $fetch=MYSQLI_ASSOC) {

RE: Where/when is the myamiweb administrator account created? - Added by Anchi Cheng almost 7 years ago

For those reading this thread:

Patrick is using php-mysqli instead of the current myamiweb standard php-mysql on his web server on Ubuntu. This and other changes in git branch myami-mysqlupdate that he helps making allow this webserver support change and they will be merged to future release but not yet in the current 3.2 release nor the soon-to-be 3.3 release until fully tested.

    (1-11/11)