#1 2015-07-06 16:08:15

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Session Create returning Group Rights ID

Could SessionCreate in mORMot.pas be changed to return also the user's group id? I'm using an ajax client and want to adjust the UI depending on group.

Changing line 43821 seems the simplest way:

procedure TSQLRestServerAuthentication.SessionCreate(Ctxt: TSQLRestServerURIContext;
  var User: TSQLAuthUser);
var Session: TAuthSession;
begin
  if User<>nil then
  try // now client is authenticated -> create a session
    fServer.SessionCreate(User,Ctxt,Session); // call Ctxt.AuthenticationFailed on error
    if Session<>nil then
      // CHANGED LINE 43821:
      Ctxt.Returns(['result',Session.fPrivateSalt,'logonname',Session.User.LogonName,'groupid',Session.User.GroupRights.ID]);
  finally
    User.Free;
  end;
end;

Offline

#2 2015-07-06 17:16:17

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

Re: Session Create returning Group Rights ID

Offline

#3 2015-07-06 19:09:51

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: Session Create returning Group Rights ID

Many thanks

Offline

Board footer

Powered by FluxBB