Skip to Content.
Sympa Menu

grouper-dev - [grouper-dev] RE: SubjectFinder: Converting subject Id to Subject object without LDAP lookup

Subject: Grouper Developers Forum

List archive

[grouper-dev] RE: SubjectFinder: Converting subject Id to Subject object without LDAP lookup


Chronological Thread 
  • From: Chris Hyzer <>
  • To: John Gasper <>, "" <>
  • Subject: [grouper-dev] RE: SubjectFinder: Converting subject Id to Subject object without LDAP lookup
  • Date: Sat, 9 May 2015 14:39:08 +0000
  • Accept-language: en-US

The subject id (not identifier) is a column in the members table.  So the easy way is to use the DB API:

 

gsh 0% GrouperSession.startRootSession();

edu.internet2.middleware.grouper.GrouperSession: 5c21cf0d38b04eb68eedb4dcd0b9b066,'GrouperSystem','application'

gsh 1% GrouperDAOFactory.getFactory().getMember().findBySubject("test.subject.0", "jdbc", false);

member: id='test.subject.0' type='person' source='jdbc' uuid='fc98430743f7435d9f69286624a2f8b5'

gsh 2% GrouperDAOFactory.getFactory().getMember().findBySubject("test.subject.0xyz", "jdbc", false);

 

 

If it finds a member object based on subject id and source id, then its there.  If not, its not.  If its not there, then it has nothing (no memberships, privs, permissions, etc)

 

If you don’t want to tie directly to the DB API (which isn’t the outward facing Grouper API), you can make a subject instance, and use the MemberFinder method.  This is preferred over the first method

 

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

gsh 1% Subject subject = new SubjectImpl("test.subject.0", null, null, "person", "jdbc");

gsh 2% MemberFinder.findBySubject(grouperSession, subject, false);

member: id='test.subject.0' type='person' source='jdbc' uuid='fc98430743f7435d9f69286624a2f8b5'

gsh 3% subject = new SubjectImpl("test.subject.0xyz", null, null, "person", "jdbc");

subject: id='test.subject.0xyz' type='person' source='jdbc' name='null'

gsh 4% MemberFinder.findBySubject(grouperSession, subject, false);

gsh 5%

 

Thanks,

Chris

 

 

From: [mailto:] On Behalf Of John Gasper
Sent: Friday, May 08, 2015 6:58 PM
To:
Subject: [grouper-dev] SubjectFinder: Converting subject Id to Subject object without LDAP lookup

 

Hi all,

 

I’m working on a membership clean up script. Given a list of subject ids (which may or may not be in Grouper), I'm trying to resolve a Subject object so I can search for memberships:

final Subject subject = SubjectFinder.findByIdAndSource(uid, sourceId, false);

 

This generally works fine, but I’m hitting ldap un-necessarily since many of these records don’t exists in Grouper. So my question is what is the recommend way of checking if a given subject id string exists in the Grouper system without the lookup pinging the Subject source system.

 

Any thoughts?

 

Thanks,

John

 

-- 

John Gasper
IAM Consultant
Unicon, Inc.
PGP/GPG Key: 0xbafee3ef

 




Archive powered by MHonArc 2.6.16.

Top of Page