Skip to Content.
Sympa Menu

grouper-dev - RE: [grouper-dev] RE: Unique group extension

Subject: Grouper Developers Forum

List archive

RE: [grouper-dev] RE: Unique group extension


Chronological Thread 
  • From: Chris Hyzer <>
  • To: Gagné Sébastien <>, "" <>
  • Subject: RE: [grouper-dev] RE: Unique group extension
  • Date: Tue, 3 Apr 2012 05:36:10 +0000
  • Accept-language: en-US

Ok, got it, I think the hook code needs an edit… it Is checking on update if the group exists…  try changing:

 

FROM:

 

                /**

                * @see edu.internet2.middleware.grouper.hooks.GroupHooks#groupPreUpdate(edu.internet2.middleware.grouper.hooks.beans.HooksContext,

                *      edu.internet2.middleware.grouper.hooks.beans.HooksGroupBean)

                */

                @Override

                public void groupPreUpdate(HooksContext hooksContext, HooksGroupBean preUpdateBean) {

                                Group group = preUpdateBean.getGroup();

                                verifyUniqueExtension(group);

                }

 

 

TO:

 

  /**

   * @see edu.internet2.middleware.grouper.hooks.GroupHooks#groupPreUpdate(edu.internet2.middleware.grouper.hooks.beans.HooksContext, edu.internet2.middleware.grouper.hooks.beans.HooksGroupBean)

   */

  @Override

  public void groupPreUpdate(HooksContext hooksContext, HooksGroupBean preUpdateBean) {

    Group group = preUpdateBean.getGroup();

    if (group.dbVersionDifferentFields().contains(Group.FIELD_EXTENSION) || group.dbVersionDifferentFields().contains(Group.FIELD_NAME)) {

      verifyUniqueExtension(group);

    }

  }

 

 

Thanks,

Chris

 

 

From: Gagné Sébastien [mailto:]
Sent: Monday, April 02, 2012 10:14 AM
To: Chris Hyzer;
Subject: RE: [grouper-dev] RE: Unique group extension

 

Here are more information, hope that helps . Thank you

 

How I am adding group using the UI :

-          Log in the normal UI (not liteui)

-          Explore : go in the stem

-          “Create group” link

-          Fill info

-          Save

 

Then I get the error

 

While in the database I only have these 2  groups :

 

 

I tried adding a new group using the Lite UI and the hook triggered and returned to the “Add group screen”, but it seems the group was added the in database! :

New groups from the LiteUI :

 

 

Further testing confirmed that the LiteUI adds the group in the database, but triggers the veto (might be a second operation after the initial add ? Maybe an update?), while adding a group in the normal UI also triggers the veto, but does not add the group in the database.

 

 

Using the GSH, everything seems to be fine, the hook is not rejecting the first one but works for the second one with the same extension :

 

gsh 0% GrouperSession grouperSession = GrouperSession.startRootSession();

gsh 1% new GroupSave(grouperSession).assignName("test:someTestGrou").assignCreateParentStemsIfNotExist(true).save();

group: name='test:someTestGrou' displayName='test:someTestGrou' uuid='dba9b63d512541ff8f0529173a9b2114'

gsh 2% new GroupSave(grouperSession).assignName("test2:someTestGrou").assignCreateParentStemsIfNotExist(true).save();

// Error: unable to evaluate command: Sourced file: inline evaluation of: ``new GroupSave(grouperSession).assignName("test2:someTestGrou").assignCreateParen . . . '' : Method Invocation save

// See error log for full stacktrace

// caused by: edu.internet2.middleware.grouper.hooks.logic.HookVeto:

// veto.group.unique.extension: The group ID is already in use by a group, please use a different ID <br/><br/> [Group[name=test:someTestGrou,uuid=dba9b63d512541ff8f0529173a9b2114]]

 

 

All this leads me to think that the problem might be somewhere in the UI and that the database have nothing to do with this.

 

 

De : [] De la part de Chris Hyzer
Envoyé : 31 mars 2012 08:21
À : Gagné Sébastien;
Objet : [grouper-dev] RE: Unique group extension

 

This works for me with mysql...  I can try oracle a little later.  So you are saying if you run this GSH, that the first one will fail and not the second one?  Also, how were you adding groups, with the UI?

gsh 0%     GrouperSession grouperSession = GrouperSession.startRootSession();
gsh 1%
gsh 2% new GroupSave(grouperSession).assignName("test:someTestGrou").assignCreateParentStemsIfNotExist(true).save();
group: name='test:someTestGrou' displayName='test:someTestGrou' uuid='416e55dc6ce3476e8a4488abfc752efa'
gsh 3% new GroupSave(grouperSession).assignName("test:someTestGrou2").assignCreateParentStemsIfNotExist(true).save();
group: name='test:someTestGrou2' displayName='test:someTestGrou2' uuid='181c8263e40649b2987bc2a1ed6261a4'
gsh 4% new GroupSave(grouperSession).assignName("test2:someTestGrou").assignCreateParentStemsIfNotExist(true).save();
// Error: unable to evaluate command: Sourced file: inline evaluation of: ``new GroupSave(grouperSession).assignName("test2:someTestGrou").assignCreateParen . . . '' : Method Invocation save
// See error log for full stacktrace
// caused by: edu.internet2.middleware.grouper.hooks.logic.HookVeto:
// veto.group.unique.extension: The group ID is already in use by a group, please use a different ID <br/><br/> [Group[name=test:someTestGrou,uuid=416e55dc6ce3476e8a4488abfc752efa]]
gsh 5%

Thanks,
Chris


From: Chris Hyzer
Sent: Friday, March 30, 2012 11:01 AM
To: Gagné Sébastien;
Subject: RE: Unique group extension

That’s weird… cant think of why this wouldn’t still work, hooks should work the same.  Can you tell me what type of DB you have and send me the hook code as well, and the configuration you use in the grouper.properties so I can try it out?

 

Thanks,

Chris

 

From: [] On Behalf Of Gagné Sébastien
Sent: Friday, March 30, 2012 10:58 AM
To:
Subject: [grouper-dev] Unique group extension

 

Hello again,

Some time ago I asked about having unique group extension. Chris replied with a very helpful group hook and all was working fine with Grouper 2.0.1. Since then I installed Grouper 2.1 and the hook doesn’t work anymore. I suspect it’s because of the hibernate update, but wanted to confirm the behaviour first before doing a new hook.

 

Basically, the hook executed this query ["select count(g) from Group as g where g.extensionDb = :theExtension"] and checked if it returned anything [if count>0 throw exception]

 

It worked before the update, but now it always fails, even with a fresh database. I checked the database and GROUPER_GROUPS contains only one entry for the sysadmingroup.

 

To check what was returned, I added the output of this query in the error message : "select g from Group as g where g.extensionDb = :theExtension".

 

I tried to add the group with the ID “UdeM:test” I got this as the query content : name=UdeM:test,uuid=22c78379869e43e28a88f4e54826bafb. I rechecked the database and there is still only one group.

 

Any lead on what might cause this ? Does the hooks work differently ? Does it do a temporary add in the groups before the save in the database ?

 

Thank you

 

Sébastien Gagné,     | Analyste en informatique

514-343-6111 x3384| Université de Montréal,

                     | Pavillon Roger-Gaudry, local X-100-11

 




Archive powered by MHonArc 2.6.16.

Top of Page