grouper-users - RE: [grouper-users] setting Subject attributes
Subject: Grouper Users - Open Discussion List
List archive
- From: Chris Hyzer <>
- To: Martin van Es <>, "GW Brown, Information Systems and Computing" <>, Grouper Users Mailing List <>
- Subject: RE: [grouper-users] setting Subject attributes
- Date: Thu, 5 Feb 2009 10:43:54 -0500
- Accept-language: en-US
- Acceptlanguage: en-US
> -----Original Message-----
> From: Martin van Es
> [mailto:]
> Sent: Thursday, February 05, 2009 8:48 AM
> To: GW Brown, Information Systems and Computing; Grouper Users Mailing
> List
> Subject: Re: [grouper-users] setting Subject attributes
>
> Hi Gary,
>
> Again, thx a lot for your explanation to a Grouper newby ;)
>
> On Thursday 05 February 2009 14:24:47 you wrote:
> > not even for internal subjects.
> >
> > You can set:
> >
> > # To change the internal names for GrouperAll and GrouperSystem
> > # uncomment and change. Review UI nav.properties to ensure
> consistency
>
> I meant "g:isa" (example) subjects, not the GrouperSystem account.
>
> > The UI, through resources/grouper/media.properties, allows you to
> configure
> > attributes to display - depending on the Source id:
> >
> > # Provides backwards compatability - it was assumed that all Subjects
> woud
> > have a 'description' attribute
> > subject.display.default=description
>
> But then I assume that 'description' or 'name' will be retrieved from
> subjectattributes, which are not set by addSubject() to begin with.
> I guess adding a 'description' attribute to subjectattributes for the
> added
> subject by addSubject() would fix this "beginners problem" and would be
> a
> logical thing to do, given the apparent "testing" character of
> addSubject()
> you referred to.
To add an attribute via GSH
gsh 0% attr = new RegistrySubjectAttribute();
edu.internet2.middleware.grouper.RegistrySubjectAttribute:
edu.internet2.middleware.grouper.RegistrySubjectAttribute@d23ad
gsh 2% attr.setSubjectId("hawi");
edu.internet2.middleware.grouper.RegistrySubjectAttribute:
edu.internet2.middleware.grouper.RegistrySubjectAttribute@2984376c
gsh 3% attr.setValue("This is my description");
edu.internet2.middleware.grouper.RegistrySubjectAttribute:
edu.internet2.middleware.grouper.RegistrySubjectAttribute@7f1767c8
gsh 4% attr.setSearchValue("this is my description");
edu.internet2.middleware.grouper.RegistrySubjectAttribute:
edu.internet2.middleware.grouper.RegistrySubjectAttribute@7f1767c8
gsh 6% attr.setName("descriptionAttr");
edu.internet2.middleware.grouper.RegistrySubjectAttribute:
edu.internet2.middleware.grouper.RegistrySubjectAttribute@ec9016e7
gsh 7% HibernateSession.byObjectStatic().saveOrUpdate(attr);
gsh 8%
If you want to add someone in one command, add this method to the
edu.internet2.middleware.grouper.app.gsh.addSubject class:
/**
* Add
{@link
RegistrySubject} to Groups Registry.
* <p/>
* @param i BeanShell interpreter.
* @param stack BeanShell call stack.
* @param id Subject <i>id</i>.
* @param type Subject <i>type</i>.
* @param name Subject <i>name</i>.
* @param description subject description
* @return Added
{@link
RegistrySubject}.
* @throws GrouperShellException
* @since 0.0.1
*/
public static RegistrySubject invoke(
Interpreter i, CallStack stack, String id, String type, String name,
String description)
throws GrouperShellException {
GrouperShell.setOurCommand(i, true);
try {
RegistrySubject registrySubject = RegistrySubject.add(
GrouperShell.getSession(i), id, type, name );
RegistrySubjectAttribute registrySubjectAttribute = new
RegistrySubjectAttribute();
registrySubjectAttribute.setName("description");
registrySubjectAttribute.setSearchValue(description.toLowerCase());
registrySubjectAttribute.setSubjectId(id);
registrySubjectAttribute.setValue(description);
HibernateSession.byObjectStatic().saveOrUpdate(registrySubjectAttribute);
return registrySubject;
}
catch (GrouperException eG) {
GrouperShell.error(i, eG);
}
catch (InsufficientPrivilegeException eIP) {
GrouperShell.error(i, eIP);
}
return null;
}
Then invoke do an "ant dist" from grouper_home, and call:
gsh 2% addSubject("aaaId", "person", "My name", "This is my description");
hibernatesubject: id='aaaId' type='person' name='My name'
>
> If so, then that would be my next feature request. Any developer
> listening? ;)
>
> Regards,
> Martin
- setting Subject attributes, Martin van Es, 02/05/2009
- Re: [grouper-users] setting Subject attributes, GW Brown, Information Systems and Computing, 02/05/2009
- Message not available
- Message not available
- Re: [grouper-users] setting Subject attributes, Martin van Es, 02/05/2009
- RE: [grouper-users] setting Subject attributes, Chris Hyzer, 02/05/2009
- Re: [grouper-users] setting Subject attributes, Martin van Es, 02/05/2009
- Message not available
Archive powered by MHonArc 2.6.16.