opennetadmin / ona

OpenNetAdmin IP Address Management (IPAM) system
opennetadmin.com
GNU General Public License v2.0
136 stars 34 forks source link

Admin user has no rights #150

Closed dmgeurts closed 1 year ago

dmgeurts commented 4 years ago

After modifying installcli.php in the way it creates the ona_sys mysql account I managed to complete the installation. However when logging in the admin user has no more rights than the guest user has.

I've checked the data import into the database and that completed successfully.

Some debug logs:

Jan 8 22:14:17 unifipi anonymous@192.168.100.162: [DEFAULT] DEBUG => db_get_record($dbh, $where, groups, ) called
Jan 8 22:14:17 unifipi anonymous@192.168.100.162: [DEFAULT] ERROR => SQL query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups WHERE name = ''' at line 1
Jan 8 22:14:17 unifipi anonymous@192.168.100.162: [DEFAULT] DEBUG => db_get_records($dbh, $where, permission_assignments, , -1, -1) called
Jan 8 22:14:17 unifipi admin@192.168.100.162: [DEFAULT] INFO => Loaded permissions for admin
Jan 8 22:14:17 unifipi admin@192.168.100.162: [DEFAULT] INFO => [Standalone] admin has logged in via authtype: local
...
Jan 8 22:14:23 unifipi anonymous@192.168.100.162: [DEFAULT] DEBUG => db_update_record($dbh, sessions, $where, $insert) called
Jan 8 22:14:23 unifipi admin@192.168.100.162: [DEFAULT] DEBUG => webwin_submit() Window: edit_subnet Function: editor Form:  
Jan 8 22:14:23 unifipi admin@192.168.100.162: [DEFAULT] DEBUG => auth() User[admin] does not have the subnet_modify permission
mattpascoe commented 4 years ago

hmm this one is odd.. if it got as far as it did, it should have the proper access defined. seems the error there does not have the name variable passing through for some reason.

I'll try and catch up to where you are.. I've not yet tried ONA on Ubuntu 19.10 (yea, sad)..

You might try dropping the database entirely and trying from the beginning with your updates to the cli installer.

mattpascoe commented 4 years ago

So.. I found the problem here.. apparently mysql 8 no longer likes my table named 'groups'.. I think it is now a reserved word. So I have updated the appropriate things to fix that.. but now have found another issue. I'll check in my fixes for this bug and open another one related to the new issue.

dmgeurts commented 4 years ago

Dev code works, except for:

  1. MySQL user isn't created (temporary fix, create the account either before or after installing.
  2. Default domain isn't set (due to known ctime error)
soif commented 3 years ago

FYI

I've just switched from the master branch (fresh install from yesterday) to the develop branch (today).

Once done, and after re-running the installer, I've noticed that the version warning was still there (update not completely performed) and, worse, that Admin, no longer had any permissions.

The cure was to run this query

INSERT INTOauth_groupsVALUES (17,'Default','Default user group',1),(18,'Admin','Admin group',99);

I guess that the updates forget or fail to do it properly..

Then RE run the installer step.

It seems to work fine from now

HTH somemone

mattpascoe commented 1 year ago

These issues should now be resolved in the latest v19.0.0 release.