Skip to Content.
Sympa Menu

grouper-dev - [grouper-dev] Hooks and the UI....

Subject: Grouper Developers Forum

List archive

[grouper-dev] Hooks and the UI....


Chronological Thread 
  • From: "Black, Carey M." <>
  • To: "" <>
  • Subject: [grouper-dev] Hooks and the UI....
  • Date: Wed, 13 Mar 2019 03:24:42 +0000

All,

I have a desire to have a Hook "do work for the user" then "redirect them" to
a different UI page. But I am not sure how to go about it.

Specifically I am thinking this.
1) User adds a membership to a group.
2) Hook auto adds attributes assigned to the membership ( maybe in a
postCommit Membership hook) [ based on attrs on the group and elsewhere...]
3) ( Take over the world. Er.... ) Send the user to a UI page where
the user would be able to add values to the attributes that were just
assigned to the membership.
Out of scope for this question... When all values are
supplied by a user, then a change log consumer would do some
"provisioning/deprovisioning" work to another system.


Normally the user lands on a URL like :
/grouperUi/app/UiV2Main.index?operation=UiV2Group.viewGroup&groupId=<groupID>
after adding a membership to a group.
I want them to land on this URL instead.

/grouperUi/app/UiV2Main.index?operation=UiV2MembershipAttributeAssignment.viewAttributeAssignments&groupId=<groupID>

&subjectId=<subject_ID_that_was_assigned_a_Membership>&sourceId=<subject_source_id>

Which the user could navigate to in the UI by doing all of the
following:
( Starting from the "normal" outcome.)
Click on the subject that is a member that was just added. (
maybe after finding them in the list of memberships)

-->/grouperUi/app/UiV2Main.index?operation=UiV2Subject.viewSubject&subjectId=<subject_ID_that_was_assigned_a_Membership>&sourceId=<subject_source_id>
Find the "Membership" that was just created in all of the
users Memberships
Click the "actions" menu button at the end of the row
Select the "Attribute Assignments" option.
--> Get to the URL I want them at.


I did read though the hooks docs ( again ) and I did see something that might
work ( maybe? ).
RE: " Some of the built-in values for the attributes are:
HttpServletRequest, HttpServletResponse, HttpSession (Http classes for UI and
WS only). "

So I have some access to the HttpServletResponse object, but.... is
it safe to call a "sendRedirect(URL) " during a Hook? ( I am thinking
postCommit after doing the rest of the "attribute work" for the hook.)
Or is there a "designed way" to achieve my goals? ( Maybe a specific
"hook attribute" that I should set instead of calling sendRedirect myself? )


Also... IF I whisk the user away to a different URL....
Will there be any issues with later Hooks that might still be waiting
to be processed? ( My hope is they will still all fire "as normal". If they
veto.....??? the Veto shows up on the redirected URL? ( or is just eaten
because of the redirect? )


BTW: My second idea was to "fix" the action button on the group "member" UI
to have the "Attribute Assignments". ( Still the user would need to find the
person they just added. Not as useful as being auto routed there, but that
would likely be much less work for me and does not seem to be unreasonable.
Even better if the sort order was somehow set to "newest members at the top"
for the list. :) )
So if you want to point me in the right direction to patch a 2.3 UI
that way, I would be open for that too.....
To be fair, I really want that button option anyways.... And I want
the hook to auto send the user there too. ( Yea.. I like to have my cake and
eat it too. )

Thanks in advance/clue bricks. :)

--
Carey Matthew




Archive powered by MHonArc 2.6.19.

Top of Page