I'm trying to implement Server-side datatables.
In my template I have something like this:
... and in the ServerController I registered a THandlers like this:
... and I want only users that already have an active session (logged in) to access https://myip/GetSomeData and if the user is not logged in, to be redirected to the login page (main page).
The way is set up now, as in the code above, everyone can try to GetSomeData and any combinations of true of false I tried for CanStartSession, RequiresSessionStart doesn't get me the result I need. Actually, if I change anything on how I declare the THandlers.Add, I never get to TContentGetSomeData.Execute
What am I doing wrong and is this the way to do it?
In my template I have something like this:
Code:
<script type="text/javascript" class="init">
$(document).ready(function() {
$('#UTCDRTABLE').DataTable( {
"serverSide": true,
"processing": true,
"ajax": "GetSomeData",
"order": [[ 1, "desc" ]]
});
} );
</script>
... and in the ServerController I registered a THandlers like this:
Code:
with THandlers.Add('', 'GetSomeData', TContentGetSomeData.Create) do
begin
CanStartSession := true
RequiresSessionStart := false;
end;
... and I want only users that already have an active session (logged in) to access https://myip/GetSomeData and if the user is not logged in, to be redirected to the login page (main page).
The way is set up now, as in the code above, everyone can try to GetSomeData and any combinations of true of false I tried for CanStartSession, RequiresSessionStart doesn't get me the result I need. Actually, if I change anything on how I declare the THandlers.Add, I never get to TContentGetSomeData.Execute
What am I doing wrong and is this the way to do it?