grouper-users - Re: [grouper-users] Show/Hide links
Subject: Grouper Users - Open Discussion List
List archive
- From: "Sachdeva, Vivek" <>
- To: Chris Hyzer <>
- Cc: "" <>
- Subject: Re: [grouper-users] Show/Hide links
- Date: Wed, 30 Jul 2014 22:02:15 +0000
- Accept-language: en-US
The first line (GrouperSession grouperSession = GrouperSession.staticGrouperSession();) throws the same IllegalStateException.
Detail message: java.lang.IllegalStateException: There is no open GrouperSession detected.
Make sure to start a grouper session (e.g. GrouperSession.startRootSession() if you want to use a root session ) before calling this method
I added the code snippet you sent me to the doFilter method of GrouperUiFilter. That is where it was supposed to go, right??
Thanks,
Vivek
From: Chris Hyzer <>
Date: Wed, 30 Jul 2014 21:16:20 +0000 To: vivek sachdeva <> Cc: "" <> Subject: RE: [grouper-users] Show/Hide links Its kind of complicated unfortunately. If you don’t know if there is a session, you could check, and if you find one use it (root?) and if not,
create… Your way will probably work fine, but this way will definitely work now and in the future without problem: GrouperSession grouperSession = GrouperSession.staticGrouperSession();
boolean startedGrouperSession =
false;
if (grouperSession ==
null) { grouperSession = GrouperSession.startRootSession(false); startedGrouperSession =
true; }
if (!PrivilegeHelper.isWheelOrRoot(grouperSession.getSubject())) { grouperSession = grouperSession.internal_getRootSession(); }
try { boolean isWheelOrRoot = (Boolean)GrouperSession.callbackGrouperSession(grouperSession,
new GrouperSessionHandler() {
public
Object callback(GrouperSession grouperSession) throws GrouperSessionException { boolean isWheelOrRootLogic = false;
//DO WORK NOTE YOU MIGHT NEED FINAL VARS
return
isWheelOrRootLogic; } }); }
finally {
if (startedGrouperSession) { GrouperSession.stopQuietly(grouperSession); } } Thanks, Chris From: Sachdeva, Vivek []
Hi, Now, when I try yo login as someone who is in the sysadmingroup (wheel group) and I am calling PrivilegeHelper.isWheelOrRoot(sub) from the GrouperUiFilter's doFilter method, it throws exception
while executing GrouperSession.staticGrouperSession(). It works if I start session using GrouperSession.start(subjectLoggedIn) and stop it after checking if the subject is in wheelGroup or not. I want to confirm that it does not have
any side effects. Thanks, Vivek From:
vivek sachdeva <> Thanks Chris! It worked fine but I had to catch IllgealStateException coming out of GrouperSession.staticGrouperSession()
from the isWheelOrRoot method. Exception is thrown only when non wheel members try to log in. Hope it does not cause any issues later. Vivek From:
Chris Hyzer <> I think the GrouperUiFilter might be better since it is called for all the UIs. Otherwise sounds good. Thanks, Chris From:
[]
On Behalf Of Sachdeva, Vivek Hi, I need to show/hide some links based on if the logged in user is root/wheel group member or not. PrivilegeHelper class has method isWheelOrRoot(Subject
subject). If I change the LoginCheckFilter and add another session attribute something like: Session.setAttribute("RootOrWheel", true|false) And then read it on the jsp pages to decide if the links/buttons should be shown or not. What do you think, is this a good idea ?? Any other ideas?? Thanks Vivek |
- [grouper-users] Show/Hide links, Sachdeva, Vivek, 07/28/2014
- RE: [grouper-users] Show/Hide links, Chris Hyzer, 07/28/2014
- Re: [grouper-users] Show/Hide links, Sachdeva, Vivek, 07/28/2014
- Re: [grouper-users] Show/Hide links, Sachdeva, Vivek, 07/30/2014
- RE: [grouper-users] Show/Hide links, Chris Hyzer, 07/30/2014
- Re: [grouper-users] Show/Hide links, Sachdeva, Vivek, 07/30/2014
- RE: [grouper-users] Show/Hide links, Chris Hyzer, 07/31/2014
- Re: [grouper-users] Show/Hide links, Sachdeva, Vivek, 07/31/2014
- RE: [grouper-users] Show/Hide links, Chris Hyzer, 07/31/2014
- Re: [grouper-users] Show/Hide links, Sachdeva, Vivek, 07/30/2014
- RE: [grouper-users] Show/Hide links, Chris Hyzer, 07/30/2014
- Re: [grouper-users] Show/Hide links, Sachdeva, Vivek, 07/30/2014
- Re: [grouper-users] Show/Hide links, Sachdeva, Vivek, 07/28/2014
- RE: [grouper-users] Show/Hide links, Chris Hyzer, 07/28/2014
Archive powered by MHonArc 2.6.16.