This topic is locked
[SOLVED]

 Best practice for several simlar solutions

3/21/2019 4:36:12 AM
PHPRunner General questions
mbintex author

Hi there,

searching for best practice for maintaining several similar solutions.
Let´s say we have three solutions named "Small", "Medium" and "Large". They all do similar things, are equally built and have the same look and feel. But there are modules that you only find in "large" and or "medium".
All would be easy, if you have to maintain these solutions only as Saas Cloud offerings. Then you could divide the three versions simply by user rights in one file. But if you want to sell the solution for use on premises, all customers would get everything, which of course is not intended. Sadly there is no Master-Administrator ...
Do I have to build then three Phprunner files in this case? And have to eliminate every bug three times, if it exists in all three versions? And updates? Adding three times the same new feature?
Looking for a better solution with less work :-) Any ideas?

admin 3/21/2019

I think you need to keep a single project/solution and use software like ionCube to encrypt your application.

http://www.ioncube.com/

mbintex author 3/22/2019

Thanks for that, but encryption is no solution for my development.
Is there any way, that I can generate three partially identical Solutions from one Phprunner development file?

S
steveh 3/22/2019

No, you'd have to handle this in code (this is what I do) and retrieve the values either from the database, or as I do from the key provided to IonCube.
However, beware that there is currently a bug in phprunner with the session key, if you take the same code and copy to multiple directories on the server, logging into 1 copy will allow you access to all the others merely by changing the URL, so beware if you are looking to share the code in a multi tenant SaaS
Steve

admin 3/22/2019

This is not a bug, this is how PHP works. Sharing the same session key between projects means that PHP will treat it as the same project. If you don't need this to happen assign a different session key to each project. Also SAAS doesn't mean multiple copies of code. Normally you have a single copy of the code working with multiple databases.
In regards to original question - if you need to distribute your application to end users and also cannot encrypt it I don't see another option but to have a three different projects.

mbintex author 3/22/2019



In regards to original question - if you need to distribute your application to end users and also cannot encrypt it I don't see another option but to have a three different projects.


OK. Then take as a feature wish. An Option to switch on and off modules as sets for Code Generation. This would make Phprunner much more versatile. Then you could have x versions of modular Software without maintaining x Project files.

lefty 3/23/2019



OK. Then take as a feature wish. An Option to switch on and off modules as sets for Code Generation. This would make Phprunner much more versatile. Then you could have x versions of modular Software without maintaining x Project files.


I have been looking at this for a couple of days and don't get it. I use SaaS for one of my projects on a Cloud VPS and offer SaaS . Databases are different for each customer . There are numerous reasons for this . Another topic.
I use Dynamic permissions and I am the ADMIN. I would not want a customer to have full access to screw up the entire solution. So I make my project with a group that has access to do most things , let's call it CUSTOMERADMIN. Then add groups from there. You need to design your project as to have different views for the CUSTOMERADMIN group in 9.8 or lower or add pages list2/add2/edit2 for 10.0 versions or above so they can only access those pages that make critical decisions like deleting a user or a category for a product for example . Do not give anybody access to admin area.
As if it is designed for the cloud they don't need it . It really is how you designed your project for the cloud. Just use LARGE and you being the master admin disable the LARGE FOR Medium and Small / CERTAIN CUSTOMERS.
Then I have a copyof my main project let's call it LARGE on the server . If it works and I just fixed a bug or something , I easily just copy the output folder to my customer domains with another output name , Test and if successful delete old output rename new output to new one and I am done.

Then move on to next customer and do the same . pretty simple as long as you did not add any fields to database or changed security or email settings. If you add pages , Then you need to go back into admin area for all outputs and select users groups to allow access .
unless you have hundreds of customers . If you do then yes one output is the way to go , but the project has to be designed so no custom solution is available. It just works only one way .
I would suggest enterprise edition for this type of project.
If you work on one database then DYNAMIC permissions will probably not work as the possibility of duplicate data from all your customers , depends on your design and solution .





Hope this helps or someone else.





My Hierarchy Example





VPS CLOUD SERVER

Domain my design domain

LARGE OUTPUT





CLOUD SERVICE

URL/Customer1 / OUTPUT_CUSTOMER1

URL /Customer2/ OUTPUT_CUSTOMER2

URL /Customer3/ OUTPUT_CUSTOMER3

etc.........









As always , Backup your project and output as well as your SaaS files in the cloud. I have auto backup every night so I am good.

mbintex author 3/23/2019

All this is true and can be done as long as YOU are the Admin.
But we also sell our solutions for installation on premises - many customers don´t want their data in the Cloud. And then THEY are the Admin - otherwise they couldn´t change users etc. - and this way they would see things they haven´t bought and could set their permissions to get it …
By the way - if you have several Cloud customers and don´t want to have them all in one database, this is the way to do it effectively:
https://asprunner.com/forums/topic/20126-single-project-working-with-several-identical-databases/
And you can even do updates including changes of the databases:

  1. Save a Revision number somewhere in the database.
  2. Have some Code like this on After successful Login Event:



$sql="Select Revision from Einstellungen where ID=1";
if(DBLookup($sql)=="1901")
{
// Kopfbereich
$sql="ALTER TABLE Einstellungen ADD Kopfbereich mediumtext;";

DB::EXEC($sql);
//Revisionsnummer setzen

$sql="Update Einstellungen set Revision='1902'";

DB::EXEC($sql);


Last part sets the Revision number higher to the next Revision.
You can also set user Rights automatically to have the new modules available.



//Zugriffsrechte
$sql="INSERT INTO `intex hausverwaltung_ugrights` (`TableName`, `GroupID`, `AccessMask`) VALUES

('Visitenkarten', -1, 'SPM'),

('Visitenkarten', 7, 'SP'),

('Visitenkarten', 1, 'SP'),

('Versammlung', -1, 'AEDSPM'),

('Versammlung', 7, 'AEDSP'),

('Versammlung', 1, 'AESP'),

('Versammlung', -2, 'AEDSP'),

('Beschlusssammlung', -1, 'AESPM'),

('Beschlusssammlung', 7, 'AESP'),

('Beschlusssammlung', 1, 'AESP'),

('Beschlusssammlung', -2, 'AESP');";

DB::EXEC($sql);


So this way customers automatically update their databases with their next Login.

lefty 3/23/2019



All this is true and can be done as long as YOU are the Admin.
But we also sell our solutions for installation on premises - many customers don´t want their data in the Cloud. And then THEY are the Admin - otherwise they couldn´t change users etc. - and this way they would see things they haven´t bought and could set their permissions to get it …
By the way - if you have several Cloud customers and don´t want to have them all in one database, this is the way to do it effectively:
https://asprunner.co...ical-databases/
And you can even do updates including changes of the databases:

  1. Save a Revision number somewhere in the database.
  2. Have some Code like this on After successful Login Event:



$sql="Select Revision from Einstellungen where ID=1";
if(DBLookup($sql)=="1901")
{
// Kopfbereich
$sql="ALTER TABLE Einstellungen ADD Kopfbereich mediumtext;";

DB::EXEC($sql);
//Revisionsnummer setzen

$sql="Update Einstellungen set Revision='1902'";

DB::EXEC($sql);


Last part sets the Revision number higher to the next Revision.
You can also set user Rights automatically to have the new modules available.



//Zugriffsrechte
$sql="INSERT INTO `intex hausverwaltung_ugrights` (`TableName`, `GroupID`, `AccessMask`) VALUES

('Visitenkarten', -1, 'SPM'),

('Visitenkarten', 7, 'SP'),

('Visitenkarten', 1, 'SP'),

('Versammlung', -1, 'AEDSPM'),

('Versammlung', 7, 'AEDSP'),

('Versammlung', 1, 'AESP'),

('Versammlung', -2, 'AEDSP'),

('Beschlusssammlung', -1, 'AESPM'),

('Beschlusssammlung', 7, 'AESP'),

('Beschlusssammlung', 1, 'AESP'),

('Beschlusssammlung', -2, 'AESP');";

DB::EXEC($sql);


So this way customers automatically update their databases with their next Login.


I agree, I tried the method of one solution output, but I kept getting , customization requests as my solution can be a little different for each state the client is from . I do like the dynamic query to change the modules though never considered that way . Your original question was SaaS but yes I as well have clients that I have sold solutions only for their premise , so you have to give up the code in a way , but that's fine more sales the better. But I would never give up my main solution especially if is SaaS without a serious contract about the source code.
I would like to see a MasterAdmin so I think you brought a great point. Hopefully that will be looked at it for future versions. That would make things a bit easier and give the main contact / client more flexibility. It should not be hard for them to implement this as there is already an Admin , just need to double it with some restrictions. Then only the MasterAdmin can turn off and hide modules. That actually would be great as long as they don't have the source code but would be great for

SaaS.
Thanks for the response.