[MAGNOLIA-4480] MgnlContext.getUser().inGroup("xxx") throws NPE Created: 18/Jul/12  Updated: 06/Oct/12  Resolved: 25/Sep/12

Status: Closed
Project: Magnolia
Component/s: security
Affects Version/s: 4.5.3
Fix Version/s: 4.5.5

Type: Bug Priority: Major
Reporter: Richard Unger Assignee: Milan Divilek
Resolution: Fixed Votes: 0
Labels: security, usermanager
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows, 4.5.3 EE Bundle


Attachments: Text File stacktrace.txt    
Issue Links:
duplicate
is duplicated by MAGNOLIA-4569 MgnlUser.hasRole is broken (more prec... Closed
relation
is related to MAGNOLIA-3386 MgnlRole.addPermission() writes the p... Closed
is related to MAGNOLIA-4518 Unnecessary calls to unwrap JCRProper... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Calling MgnlContext.getUser().inGroup() produces NPE.

You can verify this quickly with the groovy console.

Welcome to the Magnolia Groovy Interactive Console! Type 'help' for more info and a list of available commands. [Using Groovy version 1.7.10].
mgnl> usr = MgnlContext.getUser();
===>
MgnlUser - superuser [51ae3379-67cf-4994-9e05-f97cb8bc3e4a]
mgnl> usr.inGroup("foo");
NullPointerException: null
mgnl> 


 Comments   
Comment by Ondrej Chytil [ 18/Jul/12 ]

Thanks for reporting the issue Richard.

Comment by Jan Haderka [ 24/Aug/12 ]

Use FilteringIterator and predicate to remove unwanted jcr:* props.

Comment by Jan Haderka [ 18/Sep/12 ]

you keep adding catch for IAE to all code. Why? It's a RuntimeException and there should be normally no reason to add it. Is it just default setting in your IDE or is there something deeper behind?

+                        } catch (IllegalArgumentException e) {
+                            log.debug("{} has invalid value", property.getPath());
                         }
Generated at Mon Feb 12 03:56:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.