You are not logged in.
Pages: 1
Thanks ab,
after thinking things over and for simplicity; I'll try to use cookie authentication, avoid REST services as much as I can and see where it leads me. this will help me know mORMot a little more and maybe know how to do the project in better approach.
EDIT:
BTW, if I have a procedure like this:
procedure TUserRightsApplication.Login(const LogonName, PlainPassword: RawUTF8);
is it ok,, to use the procedure for View and authenticate the user? instead of two separate procedure.
procedure TUserRightsApplication.Login; // generate the login view
function TUserRightsApplication.doLogin(const LogonName, PlainPassword: RawUTF8): TMVCAction; // called to authenticate the user
I'll try to reread the documentation and understand the samples better,, but one last question, can I use REST authentication and MVC access (cookies) at the same time (with only one login), since I'll use ajax to interact with REST and MVC controller to grant proper access to each user.
BTW, are fake URI (ex. root/methodname/json) belongs to REST or the MVC.
now, I know I'm trying to mix two things which may complicate things for better or for worse; but I really lost here.
I keep forgetting to thank you,, so thank you very much for your help.
the Start () method is overridden method which accepts MVCSession.
2. how should I use authentication with MVC?? I want to use the mormot authentication scheme which is better than anything I would come up with.
btw, I vaguely differentiate between REST and MVC, since REST is always accessible from the browser, and in fact I'll use it with Ajax for lazy loading .
I started playing with TMVCApplication to create a web application for library management; with beginner experience on mormot, I found myself struggling on my first 2 problems.
1. I want to create 2 applications one for admins and stuff,, the other one for the students and guests; I don't know if this the best approach (I can use only one app) but I decided to go this way and explore if it is good.... the first obstacle is sharing the MVCSession between the 2 applications so if student has role of stuff he can switch between the two without login again. (for now I created third app for login and this app passes it's MVCSession to other 2 so they won't create their own and all three have the same MVCSession)
it looks like this (I don't like it),, but I don't know how to do it other way.
aServer := TUMSRestServerDB.Create('UMS');
aHTTPServer := TUMSHttpServer.Create('80', [aServer]);
aUserRightsApp := TUserRightsApplication.Create;
aUserRightsApp.Start(aServer, '', 'Logins', nil); // passing nil makes app creates it's own MVCSession
// login won't have sub URI like admin and student
aAdminApp := TUMSAdminApplication.Create;
aAdminApp.Start(aServer, 'Admin', 'Admins',aUserRightsApp.CurrentSession);
aAgentStudent := TUMSStudentApplication.Create;
aAgentStudent.Start(aServer, 'Student', 'Students',aUserRightsApp.CurrentSession);
// Logins, Admins, Students are the names of static folders for each application
// application my have separated servers in future and probably AdminApp will be used locally and StudentApp will serve over internet (just an idea)
Accessing will look like this:
[SERVER]/UMS/login
[SERVER]/UMS/Admin/AdminView
[SERVER]/UMS/Student/StudentView
2. I use this for Javascript authentication, for now I tested it with default user (username:User, password:synopse) it works fine,,, but if I go to the login page again I can login infinitely and server creates new Session instance each login... how should I handle this so the user won't be able to access the login page once loged in and have only one session per user.
Any advice will be much appreciated.
thanks in advance and thank you ab for your great work.
thanks, I use similar setup - fpc trunk + rtti patch + lazarus trunk - and it works fine; but I was asking about the interfacertti branch.
Can confirm !
I meant to say: can you confirm that interfacertti branch compiles or not (since you reported it's not compiling and then it's fixed).
AOG: I can't compile the FPC with interfacertti branch; I always get this error
Start compiling package rtl-objpas for target i386-win32.
Compiling rtl-objpas\BuildUnit_rtl_objpas.pp
Compiling .\rtl-objpas\src\inc\strutils.pp
Compiling .\rtl-objpas\src\inc\widestrutils.pp
Compiling .\rtl-objpas\src\win\varutils.pp
Compiling .\rtl-objpas\src\inc\convutils.pp
Compiling .\rtl-objpas\src\inc\dateutils.pp
Compiling .\rtl-objpas\src\inc\stdconvs.pp
Compiling .\rtl-objpas\src\inc\variants.pp
The installer encountered the following error:
Compilation of "BuildUnit_rtl_objpas.pp" failed
make[2]: *** [smart] Error 1
make[2]: Leaving directory `C:/development/lazarus_RTTI.BRANCH/fpc/3.1.1/packages'
make[1]: *** [packages_smart] Error 2
make[1]: Leaving directory `C:/development/lazarus_RTTI.BRANCH/fpc/3.1.1'
make: *** [build-stamp.i386-win32] Error 2
make: Leaving directory `C:/development/lazarus_RTTI.BRANCH/fpc/3.1.1'
fpclazup: info: FPC: Running fpc make all install failed with exit code 2
Details:
fpclazup: ERROR: Error running BuildModuleCustom for module FPC
fpclazup: info: Error running fpcup. Technical details: error executing sequence fpc; line: 5, param: FPC
fpclazup: info: Error running fpcup. Technical details: error executing sequence Default; line: 3, param: fpc
Fpclazup failed.
Can you confirm, please.
PS: I'm using fpclazup.
Thank you AOG,,
it reduces the total failed operations but there is still some reported:
...
! - Socket API: 92 / 2,274 FAILED 20.32s
1
! - Websockets: 79 / 3,405 FAILED 920.34s
1=6130/s 2=6411/s 5=7164/s 10=6990/s 30=0/s 50=0/s
...
Total failed: 171 / 45,068 - Multi thread process FAILED 944.30s
...
! - Email validation process: 3 / 55 FAILED 27.91ms
! - User CQRS repository: 7,002 / 57,106 FAILED 1.01s
Total failed: 7,005 / 80,443 - DDD shared units FAILED 1.27s
Using mORMot 1.18.2458 FTS3
Running on Windows 10 64bit (10.0.10586) with code page 1252
TSQLite3LibraryStatic 3.11.1 with internal MM
Generated with: Free Pascal 3.1.1 compiler
Time elapsed for all tests: 1034.22s
Tests performed at 16-03-2016 01:28:51
Total assertions failed for all test suits: 7,176 / 21,164,965
! Some tests FAILED: please correct the code.
PS: using FPC RTTI branch and Lazarus Trunk.
Fpcup now van apply a RTTI patch to get the RTTI needed for mORMot !
fpclazup.exe --fpcURL="trunk" --lazURL="trunk" --installdir="c:\fpctrunkrtti" --getfullrepo --fpcPATCH="fpcrtti.patch"
should give you a full featured FPC/Laz trunk combo capable of running the full mORMot !!
The patch should work on all FPC version >= 3.
I think it is preferable to use the --fpcURL=RTTI instead of --fpcURL="trunk" --fpcPATCH="fpcrtti.patch" ; in my test case the RTTI brunch produced less error than the trunk + patch.
the --getfullrepo can be discarded if you don't update your fpc/lazarus much and wanted to save some disk space.
I recommend using this:
fpclazup.exe --fpcURL=RTTI --lazURL=trunk --installdir="c:\fpctrunkrtti"
@shobits1
I wouldn't agree saying mORMot or Zeos are not ready for FPC3 ... The more FPC3 isn't ready for such projects
I didn't say that but I said:
If I understood right, then mORMot is still not fully supported by FPC, and complied projects will not guaranties consistent results ...
Anyway thanks for the clarification; much appreciated .
AOG, Thanks a lot.
The suggested modification indeed solves good amount of previously reported errors and `TestSQL3 20160214 203025.log` is now ~2.14MB (previously 112MB)
this is `TestSQL3.exe` output http://pastebin.com/X6grS2Q2
and the TestSQL3 20160214 203025.log
I'm not expert in the field but I read here and their some developers troubled with recent changes to the compiler; still for me (and many others) a free development tools like Lazarus/FPC is best choice.
BTW, I tried to use the latest version of Lazarus with FPC (rtti branch) the `TestSQL3.lpi` compile fine (with tones of warnings and hints); running it produces errors but doesn't crash like my previous test (using version obtained from getlazarus.org).
Here is the output of `TestSQL3.exe` under Win10 x64 http://pastebin.com/JZMHECae
it also generate huge `TestSQL3 20160212 142455.log` (about 112MB). download the file
is there anything I can do to reduce those errors (e.g compiler option...).
is it safe to build small project using REST where client only request reports from server with one database containing 1 table with about 1 million records.
Well, thank you;
I hope FPC improves fast so we all enjoy free development tools.
If I understood right, then mORMot is still not fully supported by FPC, and complied projects will not guaranties consistent results and for the time being using Delphi is the only choice.
if I'm right then which version of Delphi is the best to work with mORMot in your honest opinion?
I'm trying to test and evaluate mORMot for an upcoming project but when I try to compile `TestSQL3.lpi` using lazarus1.6RC2 (FPC3.0) the compiler returns the following error:
mORMot.pas(22986,7) Error: Internal error 2006111510
Since the document states FPC2.7.1/3.1.1 is required, I was wondering if FPC3.0 won't work.
Now, using Lazarus 1.7/FPC3.1.1 (downloaded from getlazarus.org) the projects compiles ok; but running the generated executable (a self test for the entire framework) reports many errors and eventually crashes.
Any help would be appreciated.
Pages: 1