Skip to Content.
Sympa Menu

grouper-users - Re: Re: [grouper-users] RE: Unix GID's in Grouper

Subject: Grouper Users - Open Discussion List

List archive

Re: Re: [grouper-users] RE: Unix GID's in Grouper


Chronological Thread 
  • From:
  • To:
  • Cc:
  • Subject: Re: Re: [grouper-users] RE: Unix GID's in Grouper
  • Date: Fri, 28 May 2010 22:34:50 +0200


FYI, the unix group type hook tutorial is now at
https://spaces.internet2.edu/display/GrouperWG/fu-berlin.de

Since the hooks concept seems unclear, I will add a few notes about the
hook creation issue "soon".

> I created a database table with an auto-increment gid field and a new
> groupType for unix groups. What I don't understand is where I have to
> register the UnixGroupHook.java in my grouper.properties and where and how
> I should call the setUnixGroupId function.

Chris already answered the properties stuff. For the hook, you basically
need to extend edu.internet2.middleware.grouper.hooks.GroupHooks and
override groupPostInsert and groupPostUpdate. Grouper will call those
methods right after group creation ("groupPostInsert") or group
changes/updates ("groupPostUpdate"). For example, here's my hook - use the
log example to test the events if you like:


package de.zedat.cms.fudis.grouper.hooks;

import edu.internet2.middleware.grouper.hooks.GroupHooks;
import edu.internet2.middleware.grouper.hooks.beans.HooksContext;
import edu.internet2.middleware.grouper.hooks.beans.HooksGroupBean;
import edu.internet2.middleware.grouper.util.GrouperUtil;
import org.apache.commons.logging.Log;

/**
* Unix Group Hook
* @author Mirko Tasler
*/
public class UnixGroupHook extends GroupHooks {

private static final Log log = GrouperUtil.getLog(UnixGroupHook.class);

@Override
public void groupPostInsert(HooksContext hooksContext,
HooksGroupBean postInsert) {
// Hook to add group ID when a group of custom type
// 'unixGroup' is created
UnixGroupTypeHook.setUnixGroupId(postInsert.getGroup());
}

@Override
public void groupPostUpdate(HooksContext hooksContext,
HooksGroupBean postInsert) {
// Hook to set group ID when a group of custom type
// 'unixGroup' is changed/updated
UnixGroupTypeHook.setUnixGroupId(postInsert.getGroup());
}

}


Hope this helps,

Mirko





Archive powered by MHonArc 2.6.16.

Top of Page