سؤال

I'm trying to figure out how to implement a mechanism that decides dynamically what's the landing page for a user.

I know that the default landing page is relatively easy to customize, as you can see in the following link:

http://blogs.alfresco.com/wp/ddraper/2011/11/01/advanced-share-customization-part-1/

http://zscribble.wordpress.com/2012/02/13/how-to-change-user-landing-page-in-alfresco-share/

But it is not enough because I need go a little further; after the successful authentication of any user, I need to retrieve the site/s that a user belongs to and then redirect to the dashboard of any of the sites.

I guess there is any authentication service that redirects to TOMCAT/webapps/share/site-index.jsp, and from here to either the user dashboard or a site dashboard, depending on the parameters received. If I'm right with my assumption, I understand I just should customize such supposed authentication service in order to get the user's sites and then redirect to the appropriate site dashboard's URL.

Am I in the right way? If not, any idea on how to proceed?

Thanks.

هل كانت مفيدة؟

المحلول

There are two possible approach in order to implement a mechanism which dynamically redirects to a page after a successful authentication in Alfresco Share.

The easiest way consists in the next steps:

  1. Change the default landing page by updating the value of the tag <root-page> in the file alfresco\site-data\configurations\slingshot.site.configuration.xml (the default value is site-index).
  2. Create a custom Surf page according to the value defined before.
  3. Create a custom template-instance
  4. Create a custom FreeMarker template, exclusively containing a region that loads a webscript (will be created in the next step).
  5. Implement a webscript that decides whatever a URL to redirect to (in my case I have to retrieve the user's sites via RESTful API and then redirect to a site's dashboard)
  6. Perform the redirection similarly to the accept-invite component is doing

The other possible way is to override the classes PageView and PageViewResolver, this way you can perform the redirection to the landing page in a single step rather than two steps, what is more efficient as a consequence. I didn't developed this solution so I cannot give more details but according to what an Alfresco Engineer says, it is viable to achieve.

If you want to know more about this, read this thread.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top