So I'm just starting to play with CakePHP and was wondering if the following was possible:
A single install of Cake, with a super admin login. Then, admins that have access to specified "sub sites", and the ability to create/edit content and users on those sub sites. Finally, the ability to map domain names (not subdomains, but unique domains) to the routes; so instead of mysite.com/subsite/posts/1 it would just be newdomain.com/posts/1
Essentially, I'm looking to replicate the experience of using Wordpress Multi-user (with domain mapping).
Is this possible? If so, what should I be looking into?
Sure. You can even use the same set of code and just configure certain domains to point to the code. Then in the code base, tie a domain ID to each user and the content so it knows where it belongs. You can have admin users belong to all domains. Then when you add regular users, you can specify what domain they belong to.
You could establish the domain checking in the Config/bootstrap.php and then set the configuration for the domain like so:
Configure::write('domain_id', 'someDomainSpecificID');
Then you only have to maintain one set of code and one database from many domains.
If the domains have to be physically separate, you could set up one location for the ADMIN users (single database) and run everything against that.
There are many ways you could architect it, it just depends on what your specific needs are. It sounds like a cool project though.
Related
I have a website named satellite.com built by AngularJS+NodeJS+MongoDB, it has an authentication system by ID & password, or third-parties like Google, GitHub. It already has many user accounts.
Now, I want to build a new website named umbrella.com, its authentication system and its database by ReactJS+NodeJS+MongoDB. Umbrella.com will include the functionalities of satellite.com (which will ideally share code with satellite.com) and some other functionalities. In the future, I want both satellite.com and umbrella.com to exist and work (though satellite.com may systematically redirect to umbrella.com/satellite/).
I wonder how umbrella.com can use the existing user accounts of satellite.com. Ideally, I hope
existing users of satellite.com could sign in umbrella.com with their old credentials, and have access to their data of satellite.com
new users could sign up on satellite.com, which will be valid to umbrella.com too
new users could sign up on umbrella.com, which will be valid to satellite.com too
I have total control of the two websites. Does anyone have a clear suggestion on how to structure and share the authentication system and the database of these 2 websites?
Edit 1: one issue is that when I set up Google Authentication for satellite.com, I remember that the domain name (i.e., satellite.com) was required. So now, can we use these authentications for another domain name (i.e., umbrella.com)?
If you are not using third party authentication like Google Auth or something where you have to specifically register your domain you can achieve that by following steps:
You can keep one database structure for both website with different
front-end. For that you user can login to both websites using same
credentials.
You can also go with one backend (Node server) for both the websites
as its seems like both are same and having same functionality.
Front-end can be different.
I'm building a website for a client who wants to showcase his company's products.His company has like 5 sub companies. For example, his company is called Nazzy industries (named after Nazzy his endeared grandmama). Nazzy Industries has 5 sub-companies. One distributes snacks, one sells safety equipment, one sells cars.
I"m going to build a large website but I may want to serve sub companies in their own domains in the future. Is this possible?
This is possible with a little workaround.
You need to first verify ownership of all the domain names (through the google cloud console). Console > AppEngine > Settings > Custom Domains
In the application you will need to check from which domain the request is incoming. All languages should support that already, a simple thing.
This information is not verified from zero to production. But almost sure this can be done this way.
For both Standard and Flexible you set up your domain names in Products & Services > App Engine > Settings > Custom Domains using wildcards and subdomains in following ways:
Have services named cars, snacks, etc, which will be mapped to cars.nazzy.com, snacks.nazzy.com, etc.
Later you can separate them to different domains, like: ncars.com, nsnacks.com .
You can set it up in one way and then transition to the other without changing code or configuration of your applications at all.
I have different customers who own each their own hosted saas page on my gae app. for example:
myapp.appspot.com/customer/123
myapp.appspot.com/customer/456
each of the customers may want his domain name for example theBigDomain.com to "invisibilly" forward to myapp.appspot.com/customer/123
Please notice I want theBigDomain.com/myservlet?id=theId#aBookmarkUrl to be transmitted to the target url as myapp.appspot.com/customer/123/myservlet?id=theId#aBookmarkUrl
I searched for the google documentation and I can't find a way to do that.
Note: I don't want a redirect where the person who types theBigDomain.com finds he's not there anymore, and I don't want a frame to include my url in the theBigDomain.com since I want the user to be able to click on the back button.
In short, I want the domains to work as proxies, knowing that from what I know, proxies are not good for some content, for exampe, if my target link has a youtube video, this might not work. So I'm asking if there is a way to do a dns redirect for a url and not a domain???
Using subdomains is also limited: creating a subdomain for each customer will be a tedious work...
Using subdomains is also limited: creating a subdomain for each customer will be a tedious work...
How so? This could actually be a lot easier for you/your customers since your customers wouldn't have to deal with domain verification/DNS settings and all you would need to do is add one * (wildcard) host to your main domain pointing to ghs.googlehosted.com and adding *.yourdomain.com in your GAE apps's settings. In your app, in your framework of choice you would then see what subdomain the request came to and and handle it as the customer's unique id (instead of 123/456). See here how you would determine the subdomain on python/webapp2. If you're using a different combination of language/framework - there are alternatives functions as well.
If you still want the customers to use their own domains then it gets a little more complicated. First, they need to provide the full domain name to you, you then add it to your GAE app's settings. Next, you and your customers need to follow one of the verifications steps listed on this page: https://support.google.com/a/answer/60216?hl=en and once that is complete you would need to ask your customers to create a CNAME record on their domains/subdomains pointing to ghs.googlehosted.com. Once the CNAME record is created, you would handle this just like the if these were subdomains on your own domain, i.e. in your framework determine what domain the request came to and handle it as a customer's unique ID to serve that customer's app.
I am a new addition to the world of CakePHP, and have only created / followed the blog tutorial, and extended it with users. I have been reading the 2.0 book to become more familiar with the framework.
Before I commit to moving to CakePHP, I have a couple of questions.
Currently, I develop a multi domain / multi theme CMS system which is procedural PHP. By doing this I have been able to create a single system on a single database with multiple domains and themes.
I take the $_SERVER['SERVER_NAME'] and look it up in a table of "brands" and then return a brand_id and theme directory. I then suffix all my SQL queries with "and brand_id = X".
I am looking to move over to Cake as the current platform has become overwhelming in size and complexity.
So in short...
Can I create an application with One Core, One App, One Database that can serve Multiple Domains and Themes?
Would I use $_SERVER['SERVER_NAME'] to look up the domain and return back a brand_id and theme?
I don't really want to have multiple databases, as if we had a large number of customers making changes across all databases could prove time consuming.
I certainly don't want to have multiple controllers and multiple models, but in some cases we would want a bespoke view if a customer had a specific requirement.
Any guidance on a basic configuration to get me started would be great. Would each Model "belong to" a "brand"? How would you "serve" up a brand?
Name: Brand1 Domain: www.brand1.com ThemeDir: Brand1
Name: Brand2 Domain: www.brand2.com ThemeDir: Brand2
I have a similar situation in which I am using wildcard subdomains. I accomplished this by doing a combination of things.
In my bootstrap file I am reading in my subdomain and assigning it a value to the cakePHP cache. In my case I am calling:
Configure::write('SubdomainHTTP', $myvalue);
This would be your domain name in your case.
I am loading in my routes.php file a filename called subdomainRoute.php. This file checks to make sure that the route or subdomain in my case exists in the database. It concludes by writing the subdomain name and theme name using Configure::write like step 1.
App::uses('SubdomainRoute', 'Routes');
I glue it all together here, in my AppController.php I read the information I write in step 2. Specifically the theme name and set it using:
$this->theme = $yourtheme;
This should allow you to have different domain name themes. Given you will have to have a database to hold a list of domain names and there theme names.
I need clarification here, please. I'm currently learning EJB, and i've read about limitting the access right of methods to the users in certain "roles." I know how the metadata to limit the access rights works. But, what i dont know is how to put the users in the respective roles. Are the users' roles set in the database, and the ejb goes into the database and check to role(if so, how)? I mean, where or how to i progamatically impose that certain users belong to , for example, the customer role or the administrator role? If you know any books, you can also provide the title if you want.
Thank you.
There are several ways to declare roles in an EJB application (database, property files, LDAP ...).
Also since EJB 3.0, you can use annotations in your session beans :
#RolesAllowed("blabla")
#PermitAll
#DenyAll
#RunAs
It's called declarative authorization. As opposed to programmatic authorization (methods getCallerPrincipal() and isCallerInRole() from the javax.ejb.SessionContext object).
You can find many examples online.
User configuration is specific of the Application Server. Security in EJB is only about roles. I use Glassfish and it has many ways of configuring users: file (default), jdbc, ldap, etc. Each way is called a realm. All depends on the server you are using so check the documentation. In Glassfish is just a little tedious because of the mapping of server roles to application roles.