Details
-
Improvement
-
Resolution: Fixed
-
Minor
-
None
-
None
Description
From: grouper-users-request
On Behalf Of Marwan Ali Shaher
Sent: Tuesday, June 28, 2016 5:40 PM
To: grouper-users
Subject: Re: [grouper-users] Unique group names across folders
For those interested, a small modification to the built-in "GrouperUniqueExtensionHook" achieves the desired behavior. That is, if the desired behavior is to prevent the creation of case-insensitive groups names, even across different stems. Compiling after modifying the following two lines in the hook's source code
long count = HibernateSession.byHqlStatic().createQuery("select count(g) from Group as g where g.extensionDb = :theExtension")
.setString("theExtension", group.getExtension()).uniqueResult(long.class);
with
long count = HibernateSession.byHqlStatic().createQuery("select count(g) from Group as g where (lower(g.extensionDb) = :theExtension)")
.setString("theExtension", group.getExtension().toLowerCase()).uniqueResult(long.class);
should do it.
Thanks,
- Marwan
________________________________________
> I also noticed that it is case insensitive. Test1 can't be created
> when test1 exists. That is exactly what I need, thanks!
>
I'm experiencing something different (or maybe that's expected?), when
trying to create groups across different stems with different case
naming. My API's grouper.loader looks like this:
hooks.group.class =
edu.internet2.middleware.grouper.hooks.examples.GroupUniqueNameCaseInsensitiveHook,edu.internet2.middleware.grouper.hooks.examples.GroupUniqueExtensionHook
- First, a group is created:
gsh 1% addGroup("teststem:substem1","testgroup1","testgroup1") ;
- attempting to add a group named "testgroup1" in substem2 is not allowed as expected
gsh 2% addGroup("teststem:substem2","testgroup1","testgroup1");
// Error: unable to evaluate command: Sourced file: inline evaluation of: ``addGroup("teststem:substem2","testgroup1","testgroup1");'' : Error invoking compiled command: : Error in compiled command: edu.internet2.middleware.grouper.hooks.logic.HookVeto: veto.group.unique.extension: The group ID is already in use, please use a different ID
- attempting to add a group named "TESTGROUP1" in substem1 is also not allowed. That is great.
gsh 3% addGroup("teststem:substem1","TESTGROUP1","TESTGROUP1");
// Error: unable to evaluate command: Sourced file: inline evaluation of: ``addGroup("teststem:substem1","TESTGROUP1","TESTGROUP1");'' : Error invoking compiled command: : Error in compiled command: edu.internet2.middleware.grouper.hooks.logic.HookVeto: veto.group.unique.nameCaseInsensitive: The group ID is already in use, please use a different ID
- But, attempting to add a group named "TESTGROUP1" in substem2 is allowed
gsh 4% addGroup("teststem:substem2","TESTGROUP1","TESTGROUP1");
group: name='teststem:substem2:TESTGROUP1' displayName='teststem:substem2:TESTGROUP1' uuid='9fe717125819401bbe808a6e88decb52'
gsh 5% getGroups("substem");
group: name='teststem:substem1:testgroup1' displayName='teststem:substem1:testgroup1' uuid='87da692b7c0d4bfc994367b4e4e3eb6d'
group: name='teststem:substem2:TESTGROUP1' displayName='teststem:substem2:TESTGROUP1' uuid='9fe717125819401bbe808a6e88decb52'
Unless I'm missing something, it would be great if the case
insensitivity worked across stems. Our use case is that we are creating
groups via Grouper in Active Directory. Group names, or object names in
general, are unique there. We can concentrate on developing a custom
hook to check against our subject names and other non-group objects if
the group name uniqueness is handled by the built-in hooks.
Thanks,
Marwan Shaher
University of Colorado Boulder
> I had tried the link below and it didn't work. I wonder if this is
> related to PSP only.
> https://spaces.internet2.edu/display/Grouper/Unique+object+names+in+Grouper
>
>
>
>
> Jared
>
>
>
>
> On Fri, May 20, 2016 at 8:44 AM, Shilen Patel wrote:
>
> There's a built in hook for that. In grouper.properties, set:
>
> hooks.group.class =
> edu.internet2.middleware.grouper.hooks.examples.GroupUniqueExtensionHook
>
> Is that what you're looking for?
>
> Thanks!
>
> - Shilen
>
> From: Jared Hoffman
Date: Thursday, May 19, 2016 at 5:51
> PM To: Gouper Users <grouper-users
> <grouper-users>> Subject: [grouper-users] Unique
> group names across folders
>
> Can grouper be set to ensure uniqueness across all group names, not
> just ones in the same folder?
>
> I searched the forum archives and I found mentions of it in older
> versions but they seemed to focus on psp provisioning not uniqueness
> in grouper.
>
>
> Thanks
>
> Jared
>
>
>
> – Jared Hoffman•Associate Director for Enterprise Infrastructure
> Kenyon College LBIS•
>
>
>
>
>
> – Jared Hoffman•Associate Director for Enterprise Infrastructure
> Kenyon College LBIS•hoffmanj
>