authentication problem

newuser

New member
I just loaded dadabik last night, and have been struggling to get authentication working. The table for which I have required authentication turns up 0 records, despite logging in as a user whose ID_user in the users_table matches the ID_user value in ID_user field in the database table. When I log in as a user with admin privileges, the SQL error reporting seems to indicate that the system is checking to see if the ID_user field is equivalent to the username field. Both my users_table and authentication required database table have ID_user fields, marked by the appropriate field type, and I would think that the $current_user variable in the source should be trying to match the ID_user fields, but like I said, it seems to be comparing the ID_user field with the username field. Any help would be greatly appreciated.
 

alpha2zee

Well-known member
The current_user variable gets set to the logged-in user's username. And it is the current_user value that should be stored in the ID_user field of a table.

Perhaps you should not set the user-table's ID_user field to be of type ID_user in the form configurator.



Post Edited (11-27-05 05:20)
 

newuser

New member
Thanks for the reply. I kind of figured that that might be the way to go, but I wasn't sure. I changed the defs in the interface config so that the username was set to field type ID_user, and logged in again. Now, the SQL query looks right, but it's giving me an error: "DBMS server said, Incorrect table name". Everything worked fine before I added authentication, so I don't undertand why the table isn't being recognized now. Sorry for the confusion, but any help would again be greatly appreciated. Thanks.
 

newuser

New member
Thanks for the reply. I just found out what was wrong. From what I understood, to get authentication working, you had to have a primary key field set in the interface config for the table which requires authentication. I had an auto increment id value in my table, and set Primary Key to 1 in the interface config, and for some reason that was throwing the SQL error. I don't know if you can't have separate primary key/Unique_id and User_id fields, but when I removed the primary key: 1 and changed the field type from Unique_id to text for the id field in the interface config, authentication started working. Thanks for all your help. This is a great board, and dadabik is a great way to maintain design control while simplifying database management, so hats off.
 

sKnight

New member
I dunno, the doc clearly states:
ID_user: the ID_user of the current user will be automatically inserted into this field when you insert a new record;...

The code however is definetely using the username_user value from the current user record. Even setting the users_tab ID_user FIELD to ID_user field type, does not change this.

 

eugenio

Administrator
Staff member
sKnight wrote:

> I dunno, the doc clearly states:
> ID_user: the ID_user of the current user will be automatically
> inserted into this field when you insert a new record;...
>
> The code however is definetely using the username_user value
> from the current user record. Even setting the users_tab
> ID_user FIELD to ID_user field type, does not change this.

You are right the documentation is not clear there, and some days ago I changed it:

"ID_user: the username of the current user will be automatically inserted into this field when you insert a new record; you should not include an ID_user field in the insert/update form, see below to understand how to include/exclude a field from a form. Note that the corresponding database field type must be alphanumeric (e.g. char, varchar....)"

The new documentation version will be available when I release DaDaBIK 4.0 beta.

Bye,

 
Top