1 2 Previous Next 15 Replies Latest reply on Jul 30, 2006 12:19 PM by julien1

    Saving user specific preferences

    jkoek

      Hello,

      Does anyone know if there is a way to save userPreferences with a Portlet.
      At this moment I have seen that it is possible to save Preferences with a Portlet, however this is Page specific and not user specific.

      For instance the Weather portlet is good example.
      When I log in and edit the page the Weather Portlet preferences are saved not only for me but for everyone (page/window level).

      This means that I need to create a Specific Page for every user. But in case of the Weather the page is not different but only the parameters that need to be displayed are different.

        • 1. Re: Saving user specific preferences
          jkoek

          I'm using JBOSS 2.4.0 CR2

          • 2. Re: Saving user specific preferences

            normally it should not behave as you describe but should be specific to every user.

            I am going to check that.

            • 3. Re: Saving user specific preferences

              just checked with CR2, it works as I describe :

              I login as admin/admin, change the feed URL of the News Feed portlet. Logout then the feed URL is back to the original value.

              If I login then as user/user, I still see the original value.

              Do you have a scenario to propose ?

              • 4. Re: Saving user specific preferences
                jkoek

                I have used the user user/user.
                I will try now with the admin/admin.
                I will reinstall the JBOSS package that contains all products (EA + Portal).

                • 5. Re: Saving user specific preferences
                  jkoek

                  I have tried it with admin/admin and that works.
                  I have tried it with user/user and that don't work.

                  I have set the security for the user 'user' to personalize.

                  Underneath the logging of the database;

                  As you can see. the test-admin works but the test-user doesn't show up.

                  In your reply I saw that you tried it with admin. Can you try it with user?

                  Thanks,

                  Jeroen.


                  NSERT INTO JBP_PORTLET_STATE VALUES(3,'samples.NewsPortlet',NULL,'2006-07-24 13:48:04.715000000',NULL,NULL)
                  INSERT INTO JBP_PORTLET_STATE_ENTRY VALUES(6,'RssXml',1,NULL)
                  DELETE FROM JBP_PORTLET_STATE_ENTRY WHERE PK=6
                  INSERT INTO JBP_PORTLET_STATE_ENTRY VALUES(6,'RssXml',1,3)
                  INSERT INTO JBP_PORTLET_STATE_ENTRY_VALUE VALUES(6,'http://test-admin',0)
                  INSERT INTO JBP_INSTANCE_PER_USER VALUES(2,NULL,'admin','local._3',NULL)
                  DELETE FROM JBP_INSTANCE_PER_USER WHERE PK=2
                  INSERT INTO JBP_INSTANCE_PER_USER VALUES(2,2,'admin','local._3',NULL)
                  COMMIT
                  /*C4*/SET AUTOCOMMIT TRUE
                  /*C3*/DELETE FROM JBP_USER_PROP WHERE JBP_UID=1 AND JBP_NAME='portal.user.last-login-date'
                  INSERT INTO JBP_USER_PROP VALUES(1,'1153741696149','portal.user.last-login-date')
                  COMMIT
                  /*C4*/SET AUTOCOMMIT FALSE
                  /*C3*/SET AUTOCOMMIT TRUE
                  SET AUTOCOMMIT FALSE
                  SET AUTOCOMMIT TRUE
                  /*C4*/DELETE FROM JBP_USER_PROP WHERE JBP_UID=2 AND JBP_NAME='portal.user.last-login-date'
                  INSERT INTO JBP_USER_PROP VALUES(2,'1153742092493','portal.user.last-login-date')
                  COMMIT
                  /*C3*/SET AUTOCOMMIT FALSE
                  SET AUTOCOMMIT TRUE
                  SET AUTOCOMMIT FALSE
                  SET AUTOCOMMIT TRUE
                  /*C4*/DELETE FROM JBP_USER_PROP WHERE JBP_UID=2 AND JBP_NAME='portal.user.last-login-date'
                  INSERT INTO JBP_USER_PROP VALUES(2,'1153742216816','portal.user.last-login-date')
                  COMMIT
                  /*C3*/SET AUTOCOMMIT FALSE
                  /*C4*/SET AUTOCOMMIT TRUE
                  SET AUTOCOMMIT FALSE


                  • 6. Re: Saving user specific preferences

                    I see your point. The thing is that those portlets (news) have caching enabled so if you customize a portlet and change identity, you still have the previous entry for a while which is a very confusing experience.

                    Try to edit jboss-portal.sar/portal-samples.war/WEB-INF/portlet.xml and remove the caching entry for the news portlet and see what it gives.

                    • 7. Re: Saving user specific preferences
                      jkoek

                      Sorry for my late response.
                      But on my work my machine is put is a secure zone, which doesn't allow me to access news feeds.

                      But at home, no such thing.

                      What I did/scenario;
                      1. Login as admin/admin
                      2. Set the user rights for user and admin to personalizerecursive on the page news.
                      Set the expiration cache in portlet.xml in directory portal-samples.war to <expiration-cache>0</expiration-cache>
                      Set the expires in portlet-instances.xml for the instance NewsPortletInstance2 to

                      expires
                      0


                      3. logout admin
                      4. login as user/user
                      5. changes both newsfeed to http://www.sleutelstad.nl/rss/nieuws.xml
                      6. logout as user

                      7. login as admin
                      8. changes both newsfeed to http://radio538.nl/538/xml/rss/headlines.jsp
                      9. logout as admin

                      Verification;
                      10. Login as user
                      11. Only one of the feeds is kept http://www.sleutelstad.nl/rss/nieuws.xml
                      The other one shows the jboss matrix news feed.

                      12. Login as admin
                      13. None of the settings as been kept. Both NewsPorlets are showing the jboss newsfeed.

                      I have even stopped the JBoss AE + Portal but that didn't bring me anything.

                      So there seems to be a problem in what is saved and what not.







                      • 8. Re: Saving user specific preferences

                        There is a problem here, and its not with the portlets or the preference settings. I just tested, using your scenario, and found the page itself is being cached.

                        After I login as user, I see the original settings. Then I minimize a newsportlet and then normalize it.. it then shows the stored preferences I inputted before I logged out.

                        • 9. Re: Saving user specific preferences
                          jkoek

                          Ok, I wait for your answer on a fix/workaround.

                          • 10. Re: Saving user specific preferences
                            jkoek

                            I have tried what you said;

                            minimize and restore.

                            I conclude the following;

                            1. Only the user user/user is able to save preferences

                            2. When I do it with the user admin, the default are used.

                            3. Only a portlet without preferences will save the url. So in the news case only the top window of the two news windows is able to save the preference. In case you try to save preference on the second window it will fail.

                            So I think there is some kind of bug.


                            • 11. Re: Saving user specific preferences
                              jkoek

                              I have tried what you said;

                              minimize and restore.

                              I conclude the following;

                              1. Only the user user/user is able to save preferences

                              2. When I do it with the user admin, the default are used.

                              3. Only a portlet without preferences will save the url. So in the news case only the top window of the two news windows is able to save the preference. In case you try to save preference on the second window it will fail.

                              So I think there is some kind of bug.


                              • 12. Re: Saving user specific preferences

                                I am currently writing additional test cases for this and found a couple of bugs. That will be fixed in the next CR.

                                • 13. Re: Saving user specific preferences
                                  jkoek

                                  ok, topic closed.

                                  • 14. Re: Saving user specific preferences

                                    I have commited my test cases today in the CVS that assert the correct behavior for instances and instances per user.

                                    So now the news portlet behave correctly except that it still has caching enabled which makes the results wrong sometime.

                                    I think I can fix this by adding in the cache key the user name. So the cached fragment will belong to a particular identity.

                                    1 2 Previous Next