Jump to content

Andrea Magni

Members
  • Content Count

    110
  • Joined

  • Last visited

Everything posted by Andrea Magni

  1. Hi, anybody had troubles performing a backup of a FB3 embedded database through the TIBBackup component? Firebird 3 uses fbclient.dll as client library also for embedded connections so it seems there's something wrong in the TIBBackup component when determining the client library to use (FireDAC.Phys.IBWrapper unit, TIBLib.GetLibraryInfo function. Given sLib var is always 'fbclient.dll' it misses it is a Firebird embedded connection). We tried to force fbclient.dll as vendor lib (giving a proper value to the DriverLink property of the TIBBackup instance, we also tried to set Embedded property of the driver link manually) but no way, it is always looking for fbembed.dll instead of the specified one (fbclient.dll). A quick and dirty workaround is to copy the DLL (fbclient) with the old name (fbembed) but I would like to avoid this, if possible. Any help would be appreciated. Maybe @Dmitry Arefiev may enlight us 😉 Thanks in advance
  2. Andrea Magni

    Token/Roles not working with TMARSNetClient

    Thanks for you example, @Stuart Clennett This is what I get when I click the Test button: Login via TMARSNetClient successful Attempting GET with TMARSNetClient {"Now":"09.22.22","Token.UserName: ":"admin","Token.Roles:":"standard,admin"} Login via TMARSClient successful Attempting GET with TMARSClient {"Now":"09.22.22","Token.UserName: ":"admin","Token.Roles:":"standard,admin"} At this point I am starting to think there is something different in the Delphi version we are using (the authentication is actually endorsed through cookies (you may want to switch from cookies to Authorization header changing TMARSClient.AuthEndorsement property on both components and see what happens)). I am not aware of bugs in this area for Berlin but I may be missing something... Let me know please
  3. Andrea Magni

    Error during Execute in MARSCmd

    I really can't think what's going wrong... I recorded a short video, would you please try to step through it and see if something differs from what you are doing? Link: Would you try a different output path for your project? (to see if there something to do with privileges on file system?) If you like, we can have a remote session (Teamviewer or similar) to check it out together. Thanks for your patience
  4. Andrea Magni

    Master switch for use of tokens

    Thank you for using MARS and please feel free to provide some feedback or ask questions (if needed) and I will be happy to help! Many features of my library came as users asked for this or that thing and I managed to implement it There's nothing better for a library author than seeing developers using it 🙂
  5. Andrea Magni

    Master switch for use of tokens

    Hi, MARS core mechanisms, including authentication and authorization, take place inside TMARSActivation class. The default implementation is attribute-driven and it is hard to have such dynamic behavior through them. But you can easily inherit your own TMARSActivation descendant and tweak some of the internals. For example, in order to fullfil your request about bypassing RBAC, you can override the ReadAuthorizationInfo method (that determines if a resource/method is public, is forbidden to everybody or has a list of allowed roles defined through attributes) and fix the result at your will (for example making every request allowed or implementing some strategy of your own based on the request, the application or the specific resource invoked.... whatever). Here attached there is a unit Server.MyActivation that implements a total override of RBAC depending on a parameter of your engine (you can set this parameter in your ini file or by code in the Server.Ignition unit). Some code from the attachment, comment out CodeSite if you are not using it (it's free and you can install it from GetIt, I use it often). TMyActivation = class(TMARSActivation) protected procedure ReadAuthorizationInfo; override; end; procedure TMyActivation.ReadAuthorizationInfo; begin inherited; CodeSite.SendMsg('[STANDARD] Authent.: ' + BoolToStr(FAuthorizationInfo.NeedsAuthentication, True) + ' Author.: ' + BoolToStr(FAuthorizationInfo.NeedsAuthorization, True)); if Engine.Parameters.ByName('DisableRBAC', False).AsBoolean then begin FAuthorizationInfo.PermitAll := True; FAuthorizationInfo.DenyAll := False; FAuthorizationInfo.AllowedRoles := []; CodeSite.SendMsg('[OVERRIDE] Authent.: ' + BoolToStr(FAuthorizationInfo.NeedsAuthentication, True) + ' Author.: ' + BoolToStr(FAuthorizationInfo.NeedsAuthorization, True)); end; end; initialization TMARSActivation.CreateActivationFunc := function (const AEngine: TMARSEngine; const AApplication: TMARSApplication; const ARequest: TWebRequest; const AResponse: TWebResponse; const AURL: TMARSURL ): IMARSActivation begin Result := TMyActivation.Create(AEngine, AApplication, ARequest, AResponse, AURL); end; The initialization section is there to set the TMARSActivation.CreateActivationFunc variable, that acts like a poor-man factory for IMARSActivation. The library will call this function, if set, to instantiate the specific TMARSActivation descendant (TMyActivation in our case). You can set the parameter in the ini file of your server: [DefaultEngine] ThreadPoolSize=100 DisableRBAC=True or setting it by code for example in the Server.Ignition file (after the FEngine.Parameters.LoadFromIniFile call): FEngine.Parameters.Values['DisableRBAC'] := True; Let me know if this solves your problem. Sincerely Server.MyActivation.pas
  6. Andrea Magni

    Token/Roles not working with TMARSNetClient

    PS: the use of TMARSNetClient (TNetHTTPClient based) with respect to TMARSClient (Indy based) brings you the benefits of using the OS http stack (including https support without having to deal with OpenSSL deployment and compression support). This may be more or less important depending on the fact you are building a multiplatform app or not...
  7. Andrea Magni

    Error during Execute in MARSCmd

    Weird... Let's assume you checked out MARS in a certain folder "MARS_BASE" (mine is 'C:\Sviluppo\Librerie\MARS'). You should have MARSCmd executable in MARS_BASE\Utils\Bin\Win32 Once you ran it, it should detect MARS base folder (it's printed in the bottom left part of the MARSCmd window) and suggest you to clone MARSTemplate from MARS_BASE\Demos\MARSTemplate, when you click Next, you should be able to change the "Replace With" value with the name of your new project, then click Next again and you should see the Destination folder valued to something like MARS_BASE\Demos\NAME_OF_YOUR_PROJECT I can see from your bug report that you are using Berlin as I am in this exact moment so I actually don't understand what's going wrong. Let me know please Sincerely
  8. Andrea Magni

    Token/Roles not working with TMARSNetClient

    Hi, I just made a quick test and everything run smooth here. Please post your code and we can investigate together. Here ( https://www.dropbox.com/s/1ak4fdru3lrs2my/TestRolesProject.zip?dl=0 ) you can find a simple project, built with MARSCmd from MARSTemplate and then I added a simple helloworld/json method allowed only for 'admin' role. The [Context] Token: TMARSToken get valued correctly and the client (included in the same groupproject) at designtime seems to work properly (you can authenticate but setting Username and Password [beware: password is the hour of the day you are running the demo] on the TMARSClientToken component and perform a POST request, inspect the Roles property and see them correctly valued) and then you can execute the helloworld/json resource (again, from the IDE clicking "GET" in the ObjectInspector) and see results (that includes an echo of Token.Username on the serverside as well as Token.Roles). The test project I attached has been built with 10.1 Berlin and then I tested it with 10.3 Rio without a glitch. Let me know, I will be happy to help you out
  9. Just made a quick test using ScaleMM2 ( https://github.com/andremussche/scalemm ) with MARS (MinimalConsole demo, https://github.com/andrea-magni/MARS/tree/master/Demos/MinimalConsole) and it seems to push performances something like from 100 to 170% 🙂 If you are using MARS and want to give it a try, let me know how it works for you.
  10. Andrea Magni

    ScaleMM2 with MARS: +70% performance boost :-)

    Thanks for the suggestions, I will give them a try but here we are a bit out of my comfort zone... Thanks @Stefan Glienke!
  11. Andrea Magni

    ScaleMM2 with MARS: +70% performance boost :-)

    @David Heffernan so I guess the fact I was just brute forcing 10k requests with ab.exe (Apache Benchmark) matters as the request served was a simple hello world thing. The setup time for the execution should be way more than execution time (physiologically). It was just a simple test, but I am open to better benchmarking. Thanks
  12. Andrea Magni

    ScaleMM2 with MARS: +70% performance boost :-)

    I am not actually an expert on this so low level topics but I am sure there is a big room for optimization in MARS. So far I always focused on functionalities and ease of use and there are a couple of spots I know I can easily optimize. It's on my todo list but not really a priority at this very moment. However, any help would be greatly appreciated, just in case somebody is willing to. 😉
  13. Just pushed: https://github.com/andrea-magni/MARS/commit/a0bcbce5c43dbb45648d89e6bc3a44b74e7996bd If you define a QueryParam or any other kind of param as argument of your method (or field of your resource), you can now enforce whether it is required or not. If a required parameter is not found, MARS will throw an exception while parsing the request. HTH
  14. Andrea Magni

    mORMot running on Delphi 10.3 Rio

    @Arnaud Bouchez Glad to read this! Any chance to see it compile for the Delphi (non-ARC) Linux compiler too? I am very interested as this would imply Linux support for mORMot-JWT (https://github.com/andrea-magni/mORMot-JWT) and I guess for dMustache (https://github.com/synopse/dmustache) as well. Sincerely
  15. Hi, I guess you mean TObjectDictionary<Key,Value> from Generics.Collections... Are you looking for a general solution or you can restrict Key or Value (or both) to some more specific type?
  16. It is just a small addition to MARS Client library capabilities but TMARSClientResourceJSON now implements REST.Client.IRESTResponseJSON interface (from Delphi's REST Client library). This basically means you can use a TMARSClientResourceJSON and materialize a dataset through the TRESTResponseDataSetAdapter component (from Delphi's REST Client library). Enjoy 😉
  17. BTW, I've just updated 10.1 Berlin packages (I am not sure I have VMs for earlier versions). If you are using Berlin, let me know if your problems are now solved. Thanks
  18. @Stuart Clennett, sorry! It's my fault, still need to improve myself in maintaining the library for older Delphi versions... Which one are you using? Thanks @Stefan Glienke
  19. Andrea Magni

    Web dashboard application

    And here is a fresh new (minimal) example of producing a Bootstrap page from a MARS server. The example includes a simple GET call performed through Ajax call. Link: https://github.com/andrea-magni/MARS/tree/master/Demos/Bootstrap HTH
  20. Andrea Magni

    Web dashboard application

    Actually he was looking to keep his VCL app (with data changes notification directly from the db) and add a (responsive) web application. No need to get into the push notification thing. BTW, I noticed I currently have no Boostrap specific example in MARS repository (although I myself have several production projects using this configuration). Will try to add one to the repo ASAP.
  21. Andrea Magni

    Web dashboard application

    Hi Davide, thanks for the quote. Your scenario really suggests for a REST server (whatever library you are going to use: from WebBroker/Datasnap to mORMot, passing through RAD Server as well [if you have an edition including a license]) and a client application (a web app). Obviously I would push for MARS: easy to learn, Delphi oriented, performs well (for maximum scalability and performance I myself would consider mORMot), easy FireDAC integration and support for server side content generation (html, JS or CSS) through dMustache and DelphiRazor libraries. For the frontend there are a number of possibilities. Personally I've done much with jQuery and Bootstrap (easy and effective). If you look for something more high level (components and similar) go for React or Sencha products, but consider the licensing. UniGUI and TMS WebCore are other (commercial) options that can be effective shortcuts to your development time and can help you not to delve too much into web technologies (offering a more stable environment where to work, that is particularly useful for larger or long lasting projects). This is my (possibly biased 🙂 ) idea on the topic. Sincerely
  22. Hi all, anyone here is using TFS for Delphi projects? I never used TFS but one of my newest customers has it as internal standard. Is there IDE plugins or integrations to work with TFS? If not, are there tools for using TFS outside VS? At the moment I am considering installing VS Community and use it just for the versioning stuff but I have no idea how this is feasible / handy... Any suggestion would be greatly appreciated! Thanks Andrea
  23. Andrea Magni

    Microsoft Team Foundation System and Delphi

    Many thanks, I will give it a try! Will let you know if I will be able to use it.
  24. Andrea Magni

    User contributed samples

    Feel free to put up a github repository with your project, I will be happy to review it and I will list your project in a dedicated file in the MARS repository. Sincerely
  25. Andrea Magni

    An elegant open-source calculator for Android

    An easy way to implement formulas is to rely on FireDAC expressions. It is very powerful (I built a simple spreadsheet-like application with very small effort!) Sincerely
×