[MGNLSTK-533] pur integration in templating kit breaks with external users. Created: 20/Nov/09 Updated: 17/Dec/10 Resolved: 17/Dec/10 |
|
| Status: | Closed |
| Project: | Magnolia Standard Templating Kit (closed) |
| Component/s: | paragraphs |
| Affects Version/s: | None |
| Fix Version/s: | 1.2.2, 1.2.3, 1.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Rico Jansen | Assignee: | Federico Grilli |
| Resolution: | Outdated | Votes: | 0 |
| Labels: | vpro | ||
| Σ Remaining Estimate: | Not Specified | Remaining Estimate: | Not Specified |
| Σ Time Spent: | Not Specified | Time Spent: | Not Specified |
| Σ Original Estimate: | Not Specified | Original Estimate: | Not Specified |
| Attachments: |
|
||||||||||
| Issue Links: |
|
||||||||||
| Sub-Tasks: |
|
||||||||||
| Template: |
|
||||||||||
| Acceptance criteria: |
Empty
|
||||||||||
| Date of First Response: | |||||||||||
| Description |
|
I have an issue with an exception that occurs when I log in with an LDAP account, 2009-11-20 11:00:31,969 ERROR freemarker.runtime : Java backtrace for programmers: Caused by: java.lang.UnsupportedOperationException: not implemented for this ExternalUser It seems that the / templating-kit/paragraphs/pur/link.ftl tries to get the fullname from an external user: assign userFullName = ctx.user.getProperty("title")!userName But ExternalUser has this as public String getProperty(String propertyName) { throw new UnsupportedOperationException("not implemented for this ExternalUser"); }I am currently runing Magnolia Enterprise Edition 4.1RC1 and |
| Comments |
| Comment by Philipp Bärfuss [ 12/Jan/10 ] |
|
I will change the paragraph in a way that the UnsupportedOperationException is handled nicely (falling back on the username instead). Note: You could implement an ExternalUser subclass which would support reading this information from the LDAP server. |
| Comment by Rico Jansen [ 12/Jan/10 ] |
|
That will do the trick. About implementing my own ExternalUser subclass, it looks that would imply creating my own ExternalUserManager as well. |
| Comment by Magnolia International [ 25/Jan/10 ] |
|
For the record, ctx.user.title should work just as well as ctx.user.getProperty('title'), thanks to info.magnolia.freemarker.models.UserModel. I don't suppose this will handle the UnsupportedOperationException any better, though. edit: we could modify info.magnolia.freemarker.models.UserModel so that it handles these UnsupportedOperationException.. (so you could do ctx.user.title!ctx.user.name in this case), but I'm afraid that would only hide the problem further. On the other hand, it would simplify the templates, and wouldn't require a templating model class just for the sake of getting a user's full name. |
| Comment by Magnolia International [ 25/Jan/10 ] |
|
Here's patch for the above - if we go for this solution - copy/move issue to MAGNOLIA with appropriate description. If we want this in STK 1.2.2, we'll need to merge this into the 4.2 branch as well. (should not be an issue) |
| Comment by Federico Grilli [ 25/Jan/10 ] |
|
Another way to do this would be to have a model class (something like info.magnolia.module.templatingkit.paragraphs.UserModel) in stk for stkPURLink paragraph which would handle the exception in a graceful manner. However, this would imply also to change the link.ftl template and replace all occurrences of ctx.user with model. I'm going to attach a couple of patches for this. |
| Comment by Magnolia International [ 25/Jan/10 ] |
|
Okay, those approaches are not mutually exclusive, so please apply those patches (along with the necessary update tasks) on the 1.2 branch and the trunk - the change I'm proposing would require re-releasing the main Magnolia project and bundles from the 4.2 branches, which isn't planned for now. edit:
|
| Comment by Federico Grilli [ 27/Jan/10 ] |
|
returns the username in case a User implementation throws a UnsupportedOperationException when calling user.getProperty("title") |
| Comment by Rico Jansen [ 29/Jan/10 ] |
|
Updated our pom's and tested it. It works like a charm. |
| Comment by Magnolia International [ 29/Jan/10 ] |
|
We need to re-fix this. Updates will work (update task will add the modelClass), but fresh install will break! (we forgot to update the bootstrap file!) |
| Comment by Nils Breunese [ 29/Jan/10 ] |
|
Yep, it works on updates, not on fresh installs. Just ran into that problem... |
| Comment by Nils Breunese [ 03/Feb/10 ] |
|
After upgrading to STK 1.2.3 this problem still seems to be present when using the commenting module with external users (LDAP). Method public java.lang.String info.magnolia.cms.security.ExternalUser.getProperty(java.lang.String) threw an exception when invoked on info.magnolia.cms.security.ExternalUser@1d5d81a (...) Caused by: java.lang.UnsupportedOperationException: not implemented for this ExternalUser |
| Comment by Magnolia International [ 03/Feb/10 ] |
|
Hi Nils, Argh. Good catch. I'll try to come back to you in a couple of days to see if we can fix this in the 4.2 branch and potentially re-release it - don't hesitate to ping us about it. |
| Comment by Nils Breunese [ 04/Feb/10 ] |
|
According to my colleague (who is working on the commenting, but not at work today) the email field should be mapped from LDAP, so it's too bad that the method throws an UnsupportedOperationException. We plan on going live with our first Magnolia-powered site in March and it would be nice if this could be fixed before then... |
| Comment by Magnolia International [ 04/Feb/10 ] |
|
Nils, let's take this discussion to the users list |
| Comment by Teresa Miyar [ 21/Apr/10 ] |
|
Seems is not fixed for 4.3.1, stk 1.3, problem reported by rtr Method public java.lang.String info.magnolia.cms.security.ExternalUser.getProperty(java.lang.String) threw an exception when invoked on info.magnolia.cms.security.ExternalUser@1db2f57 |
| Comment by Teresa Miyar [ 21/Apr/10 ] |
|
the problem i think, info.magnolia.freemarker.models.MagnoliaModelFactory, is never registered, never used |
| Comment by Magnolia International [ 21/Apr/10 ] |
|
This has been solved "properly" by MagnoliaModelFactory is an interface; its implementations are used by i.m.freemarker.models.MagnoliaObjectWrapper. ... but that's correct. ${ctx.user.getProperty("foobar")!'default value'} still causes exceptions. With |
| Comment by Magnolia International [ 17/Dec/10 ] |
|
See |