Friday 03 September 2010 2:04:21 am
Just to clarify Abdelkader's answer: eZP supports SSO functionality by the way of allowing you to implement SSO handlers (as php classes with a given interface), that will be invoked at the right time by the system (i.e. whenever an anon user visits an eZP web page). There are no such handlers delivered with the system, so you will need to either code your own or get one from the community. There are a couple of existing ones for CAS, but CAS is not the only supported sso server. Back to the original question: - 'partially' loading eZP code into your other app will not work. It is too much of a complex beast. So either you wrap your other app into eZP creating a custom module/view that acts as facade (sounds crazy but it's actually doable thanks to php's great output buffering support), or you allow your other app to get the info of the current user by sniffing its session. This is simpler, and I will describe it below - to get username of currently logged in user from application B, you will need to have access to its session cookie - set up the eZP session cookie to be served with a domain/path so that it can be read by your other application - when user gets to your other app, let the app read session cookie from eZP, and either 1) go read directly its session data in the eZP db, or 2) make an http call to a special eZP page that returns the username of the current user, making sure you add the session cookie in the call To implement point 1, you will probably do some preg matching on the results of your db query, as unfortunately php has no function to hydrate session data in a specific variable - it's either in the main scope or nothing To implement point 2, you can create in eZP a custom module/view, a soap function, a rest function (if using ezjscore) or an xmlrpc or jsonrpc fun ction (if using ggwebservices). You can also implement it via custom templates that you set as override for a custom node:a pagelayout that displays username and not $module_result.content would do. But doing it this way a huge waste of resources.
Principal Consultant International Business
Member of the Community Project Board
|