#1 2014-09-24 15:33:37

alexdmatveev
Member
Registered: 2014-09-12
Posts: 87

How to get user id on client-side?

Hello everybody,

my task is to post a message in messages database table.
the table contains user_id field.

I create a message on the client side:

var
   FClient: TSQLHttpClient;

msg := TMessage.Create;
msg.Text := 'Hello';
msg.user_id := ... ; 
FClient.Add(msg, true);

I have user name as FClient.SessionUser.LogonName after FClient.SetUser().
How can I get user's ID if I logged on with User group permission... I can not just Create User from the server by his name because I have no permissions to TSQLAuthUser table.

Does the client-side way exist?

If no, then what is server-side way?


Thanks a lot.

Offline

#2 2014-09-24 16:57:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: How to get user id on client-side?

On the server side, you should have permission to retrieve an user by its ID.

I honestly can not understand exactly what you mean.
sad

Offline

#3 2014-09-24 17:52:54

alexdmatveev
Member
Registered: 2014-09-12
Posts: 87

Re: How to get user id on client-side?

Thanks for the answer.

After Client.setuser I can get partically filled client.sessionuser.
It has filled name and so... But user.id=0.

How can I get id of current session user and ids of other
users if I have names of users?

User := tuser.create(client, 'logonname=?', [client.sessionuser.logonname]);

Is it possible?

Thanks?

Offline

#4 2014-09-24 18:00:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: How to get user id on client-side?

You do not have access to the ID from the client side.

In fact, LogonName is a primary key also, so you can use this value to identify the user.

For client-side application level information corresponding to the client, you should better use a dedicated table, not TUser/TSQLAuthUser.

Offline

Board footer

Powered by FluxBB