Skip to Content.
Sympa Menu

grouper-users - RE: Removal of custom attribute in grouper

Subject: Grouper Users - Open Discussion List

List archive

RE: Removal of custom attribute in grouper


Chronological Thread 
  • From: Chris Hyzer <>
  • To: Raymond D Walker <>, "" <>
  • Subject: RE: Removal of custom attribute in grouper
  • Date: Wed, 8 Jul 2009 17:30:26 -0400
  • Accept-language: en-US
  • Acceptlanguage: en-US

I believe I have a way to do this with GSH. Please carefully review and test
before running. Also, I would like to keep a library of useful scripts like
this:

https://wiki.internet2.edu/confluence/display/GrouperWG/Useful+sample+Grouper+scripts+and+queries


Note, the long for loop line needs to be on one line with no linebreaks I
believe:

C:\mchyzer\isc\dev\grouper_v1_4\grouper\bin>gsh
Using GROUPER_HOME: C:\mchyzer\isc\dev\grouper_v1_4\grouper\bin\..
Using GROUPER_CONF:
C:\mchyzer\isc\dev\grouper_v1_4\grouper\bin\../conf
Using JAVA: "c:\dev_inst\java/bin/java"
using MEMORY: 64m-512m
...
Type help() for instructions
gsh 0% typeAdd("testType");
type: 'testType'
gsh 2% typeAddAttr("testType", "typeAttr", AccessPrivilege.READ,
AccessPrivilege.ADMIN, false);
attribute: 'typeAttr'
gsh 3% groupAddType("test:test1", "testType")
true
gsh 5% setGroupAttr("test:test1", "typeAttr", "whatever")
true
gsh 7% groupAddType("test:test2", "testType")
true
gsh 9% setGroupAttr("test:test2", "typeAttr", "whatever2")
true
gsh 11% for(theGroup :
GrouperDAOFactory.getFactory().getGroup().findAllByApproximateAttr("typeAttr",
"%")) { System.out
.println(theGroup.getName()); theGroup.deleteAttribute("typeAttr"); }
test:test1
test:test2
gsh 12% typeDelField("testType", "typeAttr");
true

> -----Original Message-----
> From: Raymond D Walker
> [mailto:]
> Sent: Wednesday, July 08, 2009 2:20 PM
> To:
>
> Subject: [grouper-users] Removal of custom attribute in grouper
>
> After creating a custom group type, then adding custom attributes, I
> was
> able to remove/delete said custom attributes via typeDelField(type
> name,
> field name). Once a custom attribute is used though, I find that it is
> unable to be removed and/or cleaned up.
>
> TypeDelField returns:
> gsh 60% typeDelField("NAUENTGROUP", "gidnumber")
> // Error: cannot delete field that is in use: gidnumber
>
> First thought was to remove all use of the attribute... Alas, there is
> no
> mechanism via either GSH or web calls... Or is there?
>
> Any suggestions other than going through tables by hand to remove the
> existence of a custom attribute that is no longer needed?
>
> I also see this as a possible issue with removing custom group types...
> Does
> it error out when dealing with custom attributes that are "still in
> use"?
> (To be honest, I haven't tried to remove a group type
> "typeDel(typeName)" to
> see if it cleans up custom attributes.) If it does remove the used
> attributes, I sill think it's not a good way of removing custom
> attributes
> due to it's destructive nature... ie. I'd like to keep around the other
> custom attributes on my custom type.
>
> Thanks for any info,
> --
> Raymond Walker
> Software Systems Engineer Sr.
> ITS Northern Arizona University
>
> Phone 928-523-0334




Archive powered by MHonArc 2.6.16.

Top of Page