You are not logged in.
Pages: 1
Hello!
I need to kill sessions from a specific user group on the server... Is this possible?
Thank you!
Offline
SessionDelete is not public... I was trying to do this from an interface (TInjectableObjectRest), using self.Server
Offline
I'm inheriting my own TSQLRestServer class, I can call SessionDelete now like advised on this topic, but I can't call/find TSQLRestServer.fSessions.Lock.
Thank you!
Last edited by imperyal (2019-02-28 14:00:20)
Offline
Yes, that's right. But there is no Lock method on fSessions[] that I can find.
Offline
Ok, I think that's TSQLRestServer.fSessions.Safe.Lock / TSQLRestServer.fSessions.Safe.Unlock
Let's hope I don't need any additional help, Thank you.
Offline
For other people that may need something like this:
procedure TDCS_ServerDB.kill_otherGroupSessions(Ctxt: TSQLRestServerURIContext);
var
i: integer;
currSession: TAuthSession;
begin
self.fSessions.Safe.Lock;
for i := self.fSessions.Count - 1 downto 0 do
begin
currSession := (self.fSessions[i] as TAuthSession);
if (currSession.GroupID = Ctxt.SessionGroup) and
(currSession.IDCardinal <> Ctxt.Session) then
self.SessionDelete(i, Ctxt);
end;
self.fSessions.Safe.UnLock;
end;
I think this is OK. Any suggestions ab?
Thank you for prompt help.
Offline
This is all implemented now and working as we want, nice!
Thank you
Offline
Pages: 1