Thanks for the update, Shilen.
-- John Gasper IAM Consultant Unicon, Inc. PGP/GPG Key: 0xbafee3ef
From: Shilen Patel <> Date: Wednesday, June 3, 2015 at 9:13 AM To: John Gasper <>, "" <> Subject: Re: [grouper-dev] Hooks and Copy Group
Sorry .. still trying to get access to the new server that’s hosting the patches..
Thanks!
- Shilen
From: John Gasper <> Date: Wednesday, June 3, 2015 at 12:07 PM To: Shilen Patel <>, "" <> Subject: Re: [grouper-dev] Hooks and Copy Group
Hi Shilen,
I’m just checking to see if you have an ETA for distributing this patch? We are trying to plan. If it will be available in the next 4-6 weeks, then we won’t have to manually patch and maintain the API.
Thanks, John
-- John Gasper IAM Consultant Unicon, Inc. PGP/GPG Key: 0xbafee3ef
From: Shilen Patel <> Date: Sunday, May 17, 2015 at 3:25 AM To: John Gasper <>, "" <> Subject: Re: [grouper-dev] Hooks and Copy Group
So I fixed the issue on Friday but haven’t been able to upload a patch yet. If you’re in a hurry for a fix, you can get the latest from github. Otherwise, hopefully I’ll be able to get the patch in place soon.
Thanks!
- Shilen
From: John Gasper <> Date: Friday, May 15, 2015 at 10:37 AM To: Shilen Patel <>, "" <> Subject: Re: [grouper-dev] Hooks and Copy Group
Hi Shilen,
What you describe sounds like it matches what I’m seeing. A patch would be great.
Thanks, John
-- John Gasper IAM Consultant Unicon, Inc. PGP/GPG Key: 0xbafee3ef
From: Shilen Patel <> Date: Friday, May 15, 2015 at 6:04 AM To: John Gasper <>, "" <> Subject: Re: [grouper-dev] Hooks and Copy Group
So I think the issue is that the group copy method in the API doesn’t handle changing the group id/extension. So instead the UI issues the copy and then it renames the group afterwards. But the hook fires first. So the solution may be for the API to
handle the new group id/extension directly. If that sounds right, I’ll create a patch.
Thanks!
- Shilen
From: John Gasper <> Date: Thursday, May 14, 2015 at 7:16 PM To: "" <> Subject: Re: [grouper-dev] Hooks and Copy Group
Following with perhaps a simpler question: What does the Group object provided by the HooksGroupBean represent. The new state, the old state, undetermined? Creating and Updating existing groups appears to work as expected. The Copy and Move UI functions
don’t seem to return objects with future/requested state.
Thanks for any insight.
-- John Gasper IAM Consultant Unicon, Inc. PGP/GPG Key: 0xbafee3ef
From: John Gasper <> Date: Monday, May 11, 2015 at 5:22 PM To: "" <> Subject: Re: [grouper-dev] Hooks and Copy Group
Sorry, got hasty on the send…
Is there an easy way to confirm that this is a Grouper API bug and not my code?
My code is pretty simplistic:
@Override public void groupPreInsert(final HooksContext hooksContext, final HooksGroupBean preInsertBean) { checkForDups(preInsertBean.getGroup().getName()); }
/* * @see edu.internet2.middleware.grouper.hooks.GroupHooks#groupPreUpdate(HooksContext, HooksGroupBean) */ @Override public void groupPreUpdate(HooksContext hooksContext, HooksGroupBean preUpdateBean) { checkForDups(preUpdateBean.getGroup().getName()); }
/** * Will invoke a check to see if the requested name already exists * @param groupName fully qualified groupName */ public void checkForDups(final String groupName) { final String shortName = removePathFromGroupName(groupName); logger.info("Trying to add {} ({}) as a new group, checking to see if the desired name exists anywhere else", groupName, shortName);
//Do ldap first since sAMAccountName should be indexed, and in Grouper we have to do a full table scan with LIKE //checkLdapForDuplicates(groupName, shortName); checkGrouperForDuplicates(groupName, shortName); }
/** * Checks the Grouper system for duplicates * @param longName the fully qualified (with path) group name * @param shortName the group name (without path) */ protected void checkGrouperForDuplicates(final String longName, final String shortName) { final Set<Group> list = GrouperDAOFactory.getFactory().getGroup().findAllByApproximateName(shortName); for (Group group : list) { final String groupName = group.getName();
if (!longName.equalsIgnoreCase(groupName) && shortName.equalsIgnoreCase(removePathFromGroupName(group.getName()))) { logger.info("Found duplicate ({}) in grouper when adding '{}' ({})", new Object[] {groupName, shortName, longName}); throw new HookVeto("hook.veto.group.name.grouper.duplicate", String.format("The desired group name (%s) already exists in Grouper as %s.", longName, group.getName())); } else { //This could happen when updating itself logger.debug("Found ({}) in Grouper when adding/updating {} ({}); allowing it", new Object[]{groupName, shortName, longName}); } } } /** * Removes path from a fully qualified group name * @param groupName a fully qualified group name * @return the last node */ protected String removePathFromGroupName(final String groupName) { final String[] namePath = groupName.split(":"); return namePath[namePath.length-1]; }
Thanks, John
-- John Gasper IAM Consultant Unicon, Inc. PGP/GPG Key: 0xbafee3ef
From: John Gasper <> Date: Monday, May 11, 2015 at 5:15 PM To: "" <> Subject: [grouper-dev] Hooks and Copy Group
I’m seeing interesting behavior related to the Grouper Hooks and Copy Group function. I’ve written a hook that prevents a duplicate Group Id from being re-used anywhere else in the system. Works great on create and insert. However, when it is called using
Copy Group (in the UI ), it has some interesting behavior… It seems that if the ID matches something (triggering the hook), when I change the group Id to something unique the old id still gets passed to the hook.
-- John Gasper IAM Consultant Unicon, Inc. PGP/GPG Key: 0xbafee3ef
|