edu.internet2.middleware.grouper.hooks.examples
Class GroupTypeSecurityHook

java.lang.Object
  extended by edu.internet2.middleware.grouper.hooks.GroupTypeTupleHooks
      extended by edu.internet2.middleware.grouper.hooks.examples.GroupTypeSecurityHook

public class GroupTypeSecurityHook
extends GroupTypeTupleHooks

 built in hook to grouper, which is turned on when it is configured in the grouper.properties.
 
 you can security certain group types which can only be added/removed to/from a group
 based on if the user doing the work is in a certain group (or wheel), or if the user is only a wheel group member.
 
 normally a user with admin rights on a group can edit the group type associations
 
 Log debug with log4j setting
 log4j.logger.edu.internet2.middleware.grouper.hooks.examples.GroupTypeSecurityHook = DEBUG
 


Field Summary
 
Fields inherited from class edu.internet2.middleware.grouper.hooks.GroupTypeTupleHooks
METHOD_GROUP_TYPE_TUPLE_POST_COMMIT_DELETE, METHOD_GROUP_TYPE_TUPLE_POST_COMMIT_INSERT, METHOD_GROUP_TYPE_TUPLE_POST_COMMIT_UPDATE, METHOD_GROUP_TYPE_TUPLE_POST_DELETE, METHOD_GROUP_TYPE_TUPLE_POST_INSERT, METHOD_GROUP_TYPE_TUPLE_POST_UPDATE, METHOD_GROUP_TYPE_TUPLE_PRE_DELETE, METHOD_GROUP_TYPE_TUPLE_PRE_INSERT, METHOD_GROUP_TYPE_TUPLE_PRE_UPDATE
 
Constructor Summary
GroupTypeSecurityHook()
           
 
Method Summary
static String groupNameFromAndGroupAttributeName(String attributeName)
           
 void groupTypeTuplePostDelete(HooksContext hooksContext, HooksGroupTypeTupleBean postDeleteBean)
          called right after a groupTypeTuple delete
 void groupTypeTuplePostInsert(HooksContext hooksContext, HooksGroupTypeTupleBean postInsertBean)
          called right after a groupTypeTuple insert
static boolean isRegisteredSuccess()
          If the hook was registered due to settings in the grouper.properties
static void registerHookIfNecessary(boolean tryAgainIfNotBefore)
          see if this is configured in the grouper.properties, if so, register this hook
static boolean resetCacheSettings()
          reset cached settings from config, return true if found some
static void vetoIfNecessary(String groupUuid, String typeUuid, String descriptionForLog)
          veto a type or attribute edit if necessary
 
Methods inherited from class edu.internet2.middleware.grouper.hooks.GroupTypeTupleHooks
groupTypeTuplePostCommitDelete, groupTypeTuplePostCommitInsert, groupTypeTuplePostCommitUpdate, groupTypeTuplePostUpdate, groupTypeTuplePreDelete, groupTypeTuplePreInsert, groupTypeTuplePreUpdate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupTypeSecurityHook

public GroupTypeSecurityHook()
Method Detail

registerHookIfNecessary

public static void registerHookIfNecessary(boolean tryAgainIfNotBefore)
see if this is configured in the grouper.properties, if so, register this hook

Parameters:
tryAgainIfNotBefore -

resetCacheSettings

public static boolean resetCacheSettings()
reset cached settings from config, return true if found some

Returns:
true if found some

vetoIfNecessary

public static void vetoIfNecessary(String groupUuid,
                                   String typeUuid,
                                   String descriptionForLog)
                            throws HookVeto
veto a type or attribute edit if necessary

Parameters:
groupUuid -
typeUuid -
descriptionForLog -
Throws:
HookVeto - if there is a problem

groupNameFromAndGroupAttributeName

public static String groupNameFromAndGroupAttributeName(String attributeName)
Parameters:
attributeName -
Returns:
the group name from the config file

groupTypeTuplePostDelete

public void groupTypeTuplePostDelete(HooksContext hooksContext,
                                     HooksGroupTypeTupleBean postDeleteBean)
Description copied from class: GroupTypeTupleHooks
called right after a groupTypeTuple delete

Overrides:
groupTypeTuplePostDelete in class GroupTypeTupleHooks
See Also:
GroupTypeTupleHooks.groupTypeTuplePostDelete(edu.internet2.middleware.grouper.hooks.beans.HooksContext, edu.internet2.middleware.grouper.hooks.beans.HooksGroupTypeTupleBean)

groupTypeTuplePostInsert

public void groupTypeTuplePostInsert(HooksContext hooksContext,
                                     HooksGroupTypeTupleBean postInsertBean)
Description copied from class: GroupTypeTupleHooks
called right after a groupTypeTuple insert

Overrides:
groupTypeTuplePostInsert in class GroupTypeTupleHooks
See Also:
GroupTypeTupleHooks.groupTypeTuplePostInsert(edu.internet2.middleware.grouper.hooks.beans.HooksContext, edu.internet2.middleware.grouper.hooks.beans.HooksGroupTypeTupleBean)

isRegisteredSuccess

public static boolean isRegisteredSuccess()
If the hook was registered due to settings in the grouper.properties

Returns:
true/false