root user not created on install

karen

Member
Hi I have to make a new application, which uses a user database that already exists.
I have changed the custom config file as below:

$users_table_name = 'users';
$users_table_id_field = 'id'; // must be an integer field and PK
$users_table_id_group_field = 'id_group'; // must be an integer field
$users_table_ids_group_others_field = 'ids_group_others'; // must be a TEXT field (if $enable_multiple_groups = 0, you can leave it empty)
$users_table_username_field = 'username'; // must be a char/varchar field
$users_table_password_field = 'password'; // must be a char/varchar field
$users_table_authentication_type_field = 'authentication_type_user'; // must be a char/varchar field, length 255, and must always contain the string "dadabik" as value

1709625558868.png
The application installs ok, however, I cannot log in as root, and when I check the database there is no root user created.
Do I need to create the root user in the database first, separately from the dadabik application?

I also noticed, it did not create a "group" table and I did not change that in the custom config?
Thanks.
 
Last edited:

eugenio

Administrator
Staff member
Hello,
if you use a custom users table, DaDaBIK doesn't create users, you have to use your own existing users.

EDIT, this is not true:
If you use a custom users table, also the groups table should be custom, I have just realized the documentation is not clear enough about that.


Best,
 
Last edited:

karen

Member
Hi Eugenio, thank you.
So if I create the custom groups, in a similar format to the dadabik groups table, can I still use the dadabik permissions? Or they will not work in this case?
 

eugenio

Administrator
Staff member
Hello,
if you use a custom users table, DaDaBIK doesn't create users, you have to use your own existing users.
If you use a custom users table, also the groups table should be custom, I have just realized the documentation is not clear enough about that.

Best,
Hello,
I think I did not fully understand your first message, you said

I also noticed, it did not create a "group" table and I did not change that in the custom config?

When I read that, I thought you meant the dadabik_groups table but probably you literally meant a table named "group"?
If you don't customize the groups table, a dadabik_groups table should have been created, could you double check?
 

karen

Member
Hi Eugenio further to above, I managed to install with my own user table, however, even though I have a user called root who is in the admin group, it wont allow me to log in and edit, I get this screen:
1709712607340.png
 

eugenio

Administrator
Staff member
Hi Eugenio further to above, I managed to install with my own user table, however, even though I have a user called root who is in the admin group, it wont allow me to log in and edit, I get this screen:
View attachment 324
You are logged in, the message highlighted is just part of the common default homepage
 

karen

Member
Hi, seems we just crossed messages! No, dadabik did not create a groups table even when I did not change that in the config, so I exported a groups table from my other app, and just imported it and changed the name and updated the custom config.
 

eugenio

Administrator
Staff member
Could you please paste here a screenshot with the list of the tables whose name start with dadabik_ you have in the db?
 

eugenio

Administrator
Staff member
I made some tests and what I wrote in my previous post is not correct (I edited): you can use a custom users table and keep the standard DaDaBIK groups table, sorry for the confusion. So if when you tried to do that, DaDaBIK did not create the dadabik_groups table, there is something wrong.

Could you try again a simple installation using the original files and just editing config_custom.php?
The config_custom file should contain, in addition to the required settings, the ones related to your custom users table e.g.

$users_table_name = 'users';
$users_table_id_field = 'id_user'; // must be an integer field and PK
$users_table_id_group_field = 'id_group'; // must be an integer field
$users_table_ids_group_others_field = 'ids_group_others'; // must be a TEXT field (if $enable_multiple_groups = 0, you can leave it empty)
$users_table_username_field = 'username_user'; // must be a char/varchar field
$users_table_password_field = 'password_user'; // must be a char/varchar field
$users_table_authentication_type_field = 'authentication_type_user'; // must be a char/varchar field, length 255, and must always contain the string "dadabik" as value

You should also disabled the following features otherwise DaDaBIK will complain during installation if custom users table is set:
$enable_users_self_registration = 0;
$enable_forgotten_password = 0;
$enable_email_confirmation = 0;

Let me know if the dadabik_groups table is created.

Best,
 

karen

Member
Hello Eugenio, I tried to install, using the code above, got all of the green ticks etc, and it said it installed ok, however when I try to log in as root I get this error:
1709824014631.png

Within the database, there are no dadabik tables created at all:
1709824381692.png
 

eugenio

Administrator
Staff member
Very strange, are you sure you are not looking into the wrong DB/table? MySQL says the id_user field is unknown but I can see it in your screenshot.
 

karen

Member
Hi Eugenio, I made a stupid error, database name incorrect in config custom 🤦‍♀️
However, I have corrected this and installed again, and now I get the following
1709886427154.png
When using our own user tables, is it necessary to add all of the dadabik fields to that table as well so that it has it's own fields and the dadabik ones?
 

eugenio

Administrator
Staff member
Hello,
yes, at least the following fields are needed:

confirmed_timestamp_user, temporary_password_user, temporary_password_timestamp_user, force_password_change_user

this is highlighted by the upgrade process if you upgrade an old DaDaBIK installation having custom users table but I've realized it's not in the documentation, we need to improve this.

There are also other fields but they are only required if you use self-registration, which is normally not used with a custom users table.

Best,
 

karen

Member
Hi Eugenio, thanks for the response.
I was just thinking - because dadabik users table has more fields, and it is better for handling adding users, would it be better in my case to do a clean install of dadabik, letting it create the users table, and then edit the users table code on my other app to match dadabik? If this is the case, which fields should I use in my other app login form? Also my other app uses bcrypt for passwords, but no problem there I can change the code on the general functions to use bcrypt.
 
Top