Class MembershipFinder
Use this class to find memberships within the Groups registry
A membership is the object which represents a join of member and group. Has metadata like type and creator, and, if an effective membership, the parent membership
Sample call
Membership membership1 = new MembershipFinder().addGroup(group1).addSubject(subject).assignEnabled(true).findMembership(true);
Sample call to find multiple memberships
Set<Object[]> members = new MembershipFinder().addMembershipId(membership1.getUuid()).addMembershipId(membership2.getUuid()).findMembershipsMembers();
Sample call to find immediate memberships of a user
Set membershipsOwnersMembers = new MembershipFinder().addSubject(subject).addField(Group.getDefaultList()).assignMembershipType(MembershipType.IMMEDIATE).assignEnabled(true).findMembershipResult().getMembershipsOwnersMembers(); for (Object membershipsOwnersMember : GrouperUtil.nonNull(membershipsOwnersMembers)) { Group group = (Group)((Object[])membershipsOwnersMember)[1]; System.out.println(group.getName()); }
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddAttributeDef
(AttributeDef attributeDef) add a attributeDef to look for.addAttributeDef
(String name) add a attributeDef to look for by name.addAttributeDefId
(String attributeDefId) add a attributeDef id to the search criteriaadd a field to filter byadd a field to filter byadd a role to look for.add a role to look for by name.addGroupId
(String groupId) add a role id to the search criteriaaddMemberId
(String memberId) add a member id to the search criteriaaddMembershipId
(String membershipId) add a membership id to the search criteriaaddPrivilegeTheUserHas
(Privilege field) add a privilege the user has for group queryaddPrivilegeTheUserHas
(String name) add a privilege the user has for group queryadd a source to the search criteriaaddSourceId
(String sourceId) add a sourceId to the search criteriaadd a stem to look for.add a stem to look for by name.add a stem id to the search criteriaaddSubject
(Subject subject) add a subject to look for.addSubjects
(Collection<Subject> subjects) add subjectsassignAttributeDefIds
(Collection<String> theAttributeDefIds) assign a collection of attributeDef ids to look forassignCheckSecurity
(boolean shouldCheckSecurity) assign if this should check security or run as grouper systemassignCustomCompositeGroup
(Group theCustomCompositeGroup) if we are are doing a custom composite, this is the groupassignCustomCompositeType
(CompositeType theCustomCompositeType) if we are are doing a custom composite, this is the composite type (intersection or complement)assignEnabled
(Boolean theEnabled) true means enabled only, false, means disabled only, and null means allassignField
(Field theField) assign a field to filter byassignFieldName
(String theFieldOrPrivilegeName) assign a field to filter by, or a privilege nameassignFields
(Collection<Field> theFields) assign a collection of fields to look forassignFieldsByName
(Collection<String> theFieldNames) assign a collection of fields to look forassignFieldType
(FieldType theFieldType) assign a field type, mutually exclusive with fieldIdassignFindAllFields
(boolean theFindAllFields) if true then find all fields in all membership and priv ownersassignGroupIds
(Collection<String> theGroupIds) assign a collection of group ids to look forassignHasDisabledDate
(Boolean theHasDisabledDate) true means memberships with disabled dates false means memberships without disabled dates null means don't filter based on this (default)assignHasEnabledDate
(Boolean theHasEnabledDate) true means memberships with enabled dates false means memberships without enabled dates null means don't filter based on this (default)assignHasFieldForAttributeDef
(boolean theHasFieldForAttributeDef) return memberships where the attributeDef has this field, note, it will return all the memberships for those attributeDefsassignHasFieldForGroup
(boolean theHasFieldForGroup) return memberships where the group has this field, note, it will return all the memberships for those membersassignHasFieldForMember
(boolean theHasField) return memberships where the member has this field, note, it will return all the memberships for those membersassignHasFieldForStem
(boolean theHasFieldForStem) return memberships where the stem has this field, note, it will return all the memberships for those stemsassignHasMembershipTypeForAttributeDef
(boolean theHasMembershipTypeForAttributeDef) return memberships where the attributeDef has this field, note, it will return all the memberships for those attributeDefsassignHasMembershipTypeForGroup
(boolean theHasMembershipTypeForGroup) return memberships where the group has this field, note, it will return all the memberships for those groupsassignHasMembershipTypeForMember
(boolean theHasMembershipType) return memberships where the member has this field, note, it will return all the memberships for those membersassignHasMembershipTypeForStem
(boolean theHasMembershipTypeForStem) return memberships where the stem has this field, note, it will return all the memberships for those stemsassignIncludeInheritedPrivileges
(boolean theIncludeInheritedPrivileges) if inherited effective privileges should be included.assignMemberIds
(Collection<String> theMemberIds) assign a collection of member ids to look forassignMembershipIds
(Collection<String> theMembershipIds) assign a collection of membership ids to look forassignMembershipType
(MembershipType theMembershipType) assign a membership typeassignPointInTimeFrom
(Timestamp pointInTimeFrom1) if searching point in time data, the start of the range of the point in time query.assignPointInTimeTo
(Timestamp pointInTimeTo1) if searching point in time data, the end of the range of the point in time query.assignPrivileges
(Collection<Privilege> thePrivileges) assign a collection of privileges (fields) to look forassignPrivilegesTheUserHas
(Collection<Privilege> thePrivilegesTheUserHas) assign a collection of fields to look for the user has for groupsassignPrivilegesTheUserHasByName
(Collection<String> thePrivilegeNamesOfPrivilegesTheUserHas) assign a collection of fields to look for the user has for groupsassignQueryOptionsForAttributeDef
(QueryOptions theQueryOptionsForAttributeDef) query options for attributeDef.assignQueryOptionsForGroup
(QueryOptions theQueryOptionsForGroup) query options for group.assignQueryOptionsForMember
(QueryOptions theQueryOptions) assignQueryOptionsForMembership
(QueryOptions theQueryOptions) assignQueryOptionsForStem
(QueryOptions theQueryOptionsForStem) query options for stem.assignRoleIds
(Collection<String> theRoleIds) assign a collection of role ids to look forassignScope
(String scope1) sql like string to limit the results of the ownerassignScopeForAttributeDef
(String theScopeForAttributeDef) if paging for attributeDef, then also filter for groupassignScopeForGroup
(String theScopeForGroup) if paging for group, then also filter for memberassignScopeForMember
(String theFilterForMember) if paging for member, then also filter for memberassignScopeForStem
(String theScopeForStem) if paging for stem, then also filter for stemassignServiceId
(String serviceId1) if filtering by service role, this is the service id (id of the attributeDefName for serviceassignServiceRole
(ServiceRole serviceRole1) if filtering by service role, this is the service id (id of the attributeDefName for serviceassignSources
(Set<Source> theSources) assign a collection of sources to look forassignSplitScopeForAttributeDef
(boolean theSplitScopeForAttributeDef) if the scope for attributeDef has spaces in it, then split by whitespace, and find results that contain all of the scope stringsassignSplitScopeForGroup
(boolean theSplitScopeForGroup) if the scope for group has spaces in it, then split by whitespace, and find results that contain all of the scope stringsassignSplitScopeForMember
(boolean theSplitScopeForMember) if the scope for member has spaces in it, then split by whitespace, and find results that contain all of the scope stringsassignSplitScopeForStem
(boolean theSplitScopeForStem) if the scope for stem has spaces in it, then split by whitespace, and find results that contain all of the scope stringsassignStem
(Stem theStem) assign a stem to search inassignStemIds
(Collection<String> theStemIds) assign a collection of stem ids to look forassignStemScope
(Stem.Scope theStemScope) assign a stem scope to look inassignSubjectHasMembershipForGroup
(Subject theSubjectHasMembershipForGroup) if the subject has a membership in the groupstatic Set<MembershipSubjectContainer>
findAllImmediateMemberhipSubjectContainers
(GrouperSession grouperSession, Subject subject) Find all the membership subject containers for a given subjectfindAttributeDefMemberships
(Collection<String> attributeDefIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity) static Membership
findByUuid
(GrouperSession grouperSession, String uuid, boolean exceptionIfNotFound, boolean enabledOnly) Find a membership within the registry by UUID.static Membership
findCompositeMembership
(GrouperSession s, Group g, Subject subj) Deprecated.see overloadstatic Membership
findCompositeMembership
(GrouperSession s, Group g, Subject subj, boolean exceptionOnNull) Return the composite membership if it exists.static Set<Membership>
findEffectiveMemberships
(GrouperSession s, Group g, Subject subj, Field f, Group via, int depth) Return effective memberships.static Membership
findImmediateMembership
(GrouperSession s, AttributeDef attributeDef, Subject subj, Field f, boolean exceptionIfNotFound) Return the immediate membership if it exists.static Membership
findImmediateMembership
(GrouperSession s, Group g, Subject subj, boolean exceptionIfNotFound) Return the immediate membership if it exists.static Membership
findImmediateMembership
(GrouperSession s, Group g, Subject subj, Field f) Deprecated.see overloadstatic Membership
findImmediateMembership
(GrouperSession s, Group g, Subject subj, Field f, boolean exceptionIfNotFound) Return the immediate membership if it exists.static Membership
findImmediateMembership
(GrouperSession s, Stem stem, Subject subj, Field f, boolean exceptionIfNotFound) Return the immediate membership if it exists.findMembers
(Group group, Field field) findMembers
(Group group, Field field, QueryOptions queryOptions) findMembers
(Group group, Field field, Set<Source> sources, QueryOptions queryOptions) findMembership
(boolean exceptionIfNotFound) find a membershipmembership result gives helper methods in processing the resultsfindMemberships
(Collection<String> groupIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled) findMemberships
(Collection<String> groupIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity) findMemberships
(Collection<String> groupIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity, FieldType fieldType) findMemberships
(Collection<String> groupIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity, FieldType fieldType, String serviceId, ServiceRole serviceRole) find a set of object arrays which have a membership, group|stem|attributeDef, and member insidefind a set of object arrays which have a PITMembershipView, PITGroup|PITStem|PITAttributeDef, PITMember, and Member inside note that for now this only supports stem, stemScope, groupIds, memberIds, sources, checkSecurity, queryOptionsForMember, scopeForMember, hasFieldForMember, pointInTimeFrom, and pointInTimeTofindStemMemberships
(Collection<String> stemIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity) static boolean
hasMemberCacheNoCheckSecurity
(String groupUuidOrName, Subject subject) see if subject is in group, do not check READ security, and cache for two minutesboolean
based on what you are querying for, see if has membership.static Set<Membership>
Grouper internal method onlystatic Set<Membership>
Grouper internal method onlystatic Set<Membership>
internal_findAllByGroupAndFieldAndPage
(Group group, Field field, int start, int pageSize, int sortLimit, int[] numberOfRecords) Grouper internal method onlystatic Set<Membership>
internal_findAllByGroupOwnerAndFieldAndType
(GrouperSession s, Group groupOwner, Field f, String type) Grouper internal method onlystatic Set<Membership>
Grouper internal method onlystatic Set<Membership>
internal_findAllCompositeByGroupAndPage
(Group group, int start, int pageSize, int sortLimit, int[] numberOfRecords) Grouper internal method onlystatic Set<Membership>
internal_findAllEffectiveByGroupAndFieldAndPage
(Group group, Field field, int start, int pageSize, int sortLimit, int[] numberOfRecords) Grouper internal method onlystatic Set<Membership>
Grouper internal method onlystatic Set<Membership>
internal_findAllImmediateByGroupAndFieldAndPage
(Group group, Field field, int start, int pageSize, int sortLimit, int[] numberOfRecords) Grouper internal method onlystatic Set<Membership>
Grouper internal method onlystatic Set<Membership>
internal_findAllImmediateByMemberAndField
(GrouperSession s, Member m, Field f, boolean enabledOnly) Grouper internal method onlystatic Set<Membership>
Grouper internal method onlyinternal_findAttributeDefSubjects
(GrouperSession s, AttributeDef attributeDef, Field f) Grouper internal method onlyinternal_findAttributeDefSubjectsImmediateOnly
(GrouperSession s, AttributeDef attributeDef, Field f) Grouper internal method onlyinternal_findGroupSubjects
(GrouperSession s, Group group, Field f) Grouper internal method onlyinternal_findGroupSubjectsImmediateOnly
(GrouperSession s, Group group, Field f) Grouper internal method onlyinternal_findMembersByType
(GrouperSession s, Group g, Field f, String type) Grouper internal method onlystatic Set<Membership>
Grouper internal method onlyGrouper internal method onlyinternal_findSubjectsStemPriv
(GrouperSession s, Stem stem, Field f) Grouper internal method onlytoString()
-
Constructor Details
-
MembershipFinder
public MembershipFinder()
-
-
Method Details
-
hasMemberCacheNoCheckSecurity
see if subject is in group, do not check READ security, and cache for two minutes- Parameters:
groupUuidOrName
-subject
-- Returns:
- true if in group and false if not
-
assignSubjectHasMembershipForGroup
if the subject has a membership in the group -
assignHasMembershipTypeForMember
return memberships where the member has this field, note, it will return all the memberships for those members- Parameters:
theHasMembershipType
-- Returns:
- this for chaining
-
assignHasFieldForGroup
return memberships where the group has this field, note, it will return all the memberships for those members- Returns:
- this for chaining
-
assignHasFieldForMember
return memberships where the member has this field, note, it will return all the memberships for those members- Parameters:
theHasField
-- Returns:
- this for chaining
-
assignPointInTimeFrom
if searching point in time data, the start of the range of the point in time query.- Parameters:
pointInTimeFrom1
-- Returns:
- this for chaining
-
assignPointInTimeTo
if searching point in time data, the end of the range of the point in time query.- Parameters:
pointInTimeTo1
-- Returns:
- this for chaining
-
assignScope
sql like string to limit the results of the owner- Parameters:
scope1
-- Returns:
- this for chaining
-
assignField
assign a field to filter by- Parameters:
theField
-- Returns:
- this for chaining
-
assignFieldName
assign a field to filter by, or a privilege name- Parameters:
theField
-- Returns:
- this for chaining
-
assignFieldType
assign a field type, mutually exclusive with fieldId- Parameters:
theFieldType
-- Returns:
- this for chaining
-
assignServiceId
if filtering by service role, this is the service id (id of the attributeDefName for service- Parameters:
serviceId1
-- Returns:
- this for chaining
-
assignServiceRole
if filtering by service role, this is the service id (id of the attributeDefName for service- Parameters:
serviceRole1
-- Returns:
- this for chaining
-
assignStemScope
assign a stem scope to look in- Parameters:
theStemScope
-- Returns:
- this for chaining
-
assignStem
assign a stem to search in- Parameters:
theStem
-- Returns:
- this for chaining
-
assignCheckSecurity
assign if this should check security or run as grouper system- Parameters:
shouldCheckSecurity
-- Returns:
- this for chaining
-
addMemberId
add a member id to the search criteria- Parameters:
memberId
-- Returns:
- this for chaining
-
addMembershipId
add a membership id to the search criteria- Parameters:
membershipId
-- Returns:
- this for chaining
-
addSubjects
add subjects- Parameters:
subjects
-- Returns:
- this for chaining
-
assignMemberIds
assign a collection of member ids to look for- Parameters:
theMemberIds
-- Returns:
- this for chaining
-
assignGroupIds
assign a collection of group ids to look for- Parameters:
theGroupIds
-- Returns:
- this for chaining
-
assignFields
assign a collection of fields to look for- Parameters:
theFields
-- Returns:
- this for chaining
-
assignPrivileges
assign a collection of privileges (fields) to look for- Parameters:
thePrivileges
-- Returns:
- this for chaining
-
assignFieldsByName
assign a collection of fields to look for- Parameters:
theFieldNames
-- Returns:
- this for chaining
-
assignStemIds
assign a collection of stem ids to look for- Parameters:
theStemIds
-- Returns:
- this for chaining
-
assignAttributeDefIds
assign a collection of attributeDef ids to look for- Parameters:
theAttributeDefIds
-- Returns:
- this for chaining
-
assignMembershipType
assign a membership type- Parameters:
theMembershipType
-- Returns:
- this for chaining
-
assignMembershipIds
assign a collection of membership ids to look for- Parameters:
theMembershipIds
-- Returns:
- this for chaining
-
addSubject
add a subject to look for.- Parameters:
subject
-- Returns:
- this for chaining
-
addGroupId
add a role id to the search criteria- Parameters:
groupId
-- Returns:
- this for chaining
-
assignRoleIds
assign a collection of role ids to look for- Parameters:
theRoleIds
-- Returns:
- this for chaining
-
assignSources
assign a collection of sources to look for- Parameters:
theSources
-- Returns:
- this for chaining
-
addGroup
add a role to look for.- Parameters:
group
-- Returns:
- this for chaining
-
addGroup
add a role to look for by name.- Parameters:
name
-- Returns:
- this for chaining
-
addField
add a field to filter by- Parameters:
name
-- Returns:
- this for chaining
-
addField
add a field to filter by- Parameters:
field
-- Returns:
- this for chaining
-
addPrivilegeTheUserHas
add a privilege the user has for group query- Parameters:
name
-- Returns:
- this for chaining
-
addPrivilegeTheUserHas
add a privilege the user has for group query- Parameters:
field
-- Returns:
- this for chaining
-
assignCustomCompositeType
if we are are doing a custom composite, this is the composite type (intersection or complement)- Parameters:
theCustomCompositeType
-- Returns:
- this for chaining
-
assignCustomCompositeGroup
if we are are doing a custom composite, this is the group- Parameters:
theCustomCompositeGroup
-- Returns:
- this for chaining
-
assignEnabled
true means enabled only, false, means disabled only, and null means all- Parameters:
theEnabled
-- Returns:
- this for chaining
-
assignHasEnabledDate
true means memberships with enabled dates false means memberships without enabled dates null means don't filter based on this (default)- Parameters:
theHasEnabledDate
-- Returns:
- this for chaining
-
assignHasDisabledDate
true means memberships with disabled dates false means memberships without disabled dates null means don't filter based on this (default)- Parameters:
theHasDisabledDate
-- Returns:
- this for chaining
-
hasMembership
public boolean hasMembership()based on what you are querying for, see if has membership. Note, you should be looking for one subject, one group, one field, etc If you are looking for multiple, it will see if anyone has that membership or any group- Returns:
- true if has membership, false if not
-
findMembershipResult
membership result gives helper methods in processing the results- Returns:
- the membership result
-
assignIncludeInheritedPrivileges
if inherited effective privileges should be included. i.e. if you query for UPDATE, then also query for ADMIN- Parameters:
theIncludeInheritedPrivileges
-- Returns:
- this for chaining
-
assignFindAllFields
if true then find all fields in all membership and priv owners- Parameters:
theFindAllFields
-- Returns:
- this for chaining
-
findMembershipsMembers
find a set of object arrays which have a membership, group|stem|attributeDef, and member inside- Returns:
- the set of arrays never null
-
findPITMembershipsMembers
find a set of object arrays which have a PITMembershipView, PITGroup|PITStem|PITAttributeDef, PITMember, and Member inside note that for now this only supports stem, stemScope, groupIds, memberIds, sources, checkSecurity, queryOptionsForMember, scopeForMember, hasFieldForMember, pointInTimeFrom, and pointInTimeTo- Returns:
- the set of arrays never null
-
findMembership
find a membership- Parameters:
exceptionIfNotFound
- true if exception should be thrown if permission not found- Returns:
- the permission or null
-
toString
-
addStem
add a stem to look for.- Parameters:
stem
-- Returns:
- this for chaining
-
addStem
add a stem to look for by name.- Parameters:
name
-- Returns:
- this for chaining
-
addStemId
add a stem id to the search criteria- Parameters:
stemId
-- Returns:
- this for chaining
-
addSourceId
add a sourceId to the search criteria- Parameters:
sourceId
-- Returns:
- this for chaining
-
addSource
add a source to the search criteria- Parameters:
source
-- Returns:
- this for chaining
-
addAttributeDef
add a attributeDef to look for.- Parameters:
attributeDef
-- Returns:
- this for chaining
-
addAttributeDef
add a attributeDef to look for by name.- Parameters:
name
-- Returns:
- this for chaining
-
addAttributeDefId
add a attributeDef id to the search criteria- Parameters:
attributeDefId
-- Returns:
- this for chaining
-
findStemMemberships
public static Set<Object[]> findStemMemberships(Collection<String> stemIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity) - Parameters:
stemIds
- to limit memberships to (cant have more than 100 bind variables)memberIds
- to limit memberships to (cant have more than 100 bind variables)membershipIds
- to limit memberships to (cant have more than 100 bind variables)membershipType
- Immediate, NonImmediate, etcfield
- if finding one field, list here, otherwise all list fields will be returnedsources
- if limiting memberships of members in certain sources, list herescope
- sql like string which will have a % appended to itstem
- if looking in a certain stemstemScope
- if looking only in this stem, or all substemsenabled
- null for all, true for enabled only, false for disabled onlyshouldCheckSecurity
- if we should check security, default to true- Returns:
- the set of arrays of Membership, Group, and Member
- See Also:
-
findMemberships
public static Set<Object[]> findMemberships(Collection<String> groupIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity) - Parameters:
groupIds
- to limit memberships to (cant have more than 100 bind variables)memberIds
- to limit memberships to (cant have more than 100 bind variables)membershipIds
- to limit memberships to (cant have more than 100 bind variables)membershipType
- Immediate, NonImmediate, etcfield
- if finding one field, list here, otherwise all list fields will be returnedsources
- if limiting memberships of members in certain sources, list herescope
- sql like string which will have a % appended to itstem
- if looking in a certain stemstemScope
- if looking only in this stem, or all substemsenabled
- null for all, true for enabled only, false for disabled onlyshouldCheckSecurity
- if we should check security, default to true- Returns:
- the set of arrays of Membership, Group, and Member
- See Also:
-
findMemberships
public static Set<Object[]> findMemberships(Collection<String> groupIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity, FieldType fieldType) - Parameters:
groupIds
- to limit memberships to (cant have more than 100 bind variables)memberIds
- to limit memberships to (cant have more than 100 bind variables)membershipIds
- to limit memberships to (cant have more than 100 bind variables)membershipType
- Immediate, NonImmediate, etcfield
- if finding one field, list here, otherwise all list fields will be returnedsources
- if limiting memberships of members in certain sources, list herescope
- sql like string which will have a % appended to itstem
- if looking in a certain stemstemScope
- if looking only in this stem, or all substemsenabled
- null for all, true for enabled only, false for disabled onlyshouldCheckSecurity
- if we should check security, default to truefieldType
- is access or list- Returns:
- the set of arrays of Membership, Group, and Member
- See Also:
-
findImmediateMembership
public static Membership findImmediateMembership(GrouperSession s, Stem stem, Subject subj, Field f, boolean exceptionIfNotFound) throws MembershipNotFoundException, SchemaException Return the immediate membership if it exists. An immediate member is directly assigned to a stem. A stem can have potentially unlimited effective memberships- Parameters:
s
- Get membership within this session context.stem
- Immediate membership has this group.subj
- Immediate membership has this subject.f
- Immediate membership has this list.exceptionIfNotFound
-- Returns:
- A
Membership
object - Throws:
MembershipNotFoundException
SchemaException
-
findMemberships
public static Set<Object[]> findMemberships(Collection<String> groupIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled) - Parameters:
groupIds
- to limit memberships to (cant have more than 100 bind variables)memberIds
- to limit memberships to (cant have more than 100 bind variables)membershipIds
- to limit memberships to (cant have more than 100 bind variables)membershipType
- Immediate, NonImmediate, etcfield
- if finding one field, list here, otherwise all list fields will be returnedsources
- if limiting memberships of members in certain sources, list herescope
- sql like string which will have a % appended to itstem
- if looking in a certain stemstemScope
- if looking only in this stem, or all substemsenabled
- null for all, true for enabled only, false for disabled only- Returns:
- the set of arrays of Membership, Group, and Member
- See Also:
-
findAttributeDefMemberships
public static Set<Object[]> findAttributeDefMemberships(Collection<String> attributeDefIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity) - Parameters:
attributeDefIds
- to limit memberships to (cant have more than 100 bind variables)memberIds
- to limit memberships to (cant have more than 100 bind variables)membershipIds
- to limit memberships to (cant have more than 100 bind variables)membershipType
- Immediate, NonImmediate, etcfield
- if finding one field, list here, otherwise all list fields will be returnedsources
- if limiting memberships of members in certain sources, list herescope
- sql like string which will have a % appended to itstem
- if looking in a certain stemstemScope
- if looking only in this stem, or all substemsenabled
- null for all, true for enabled only, false for disabled onlyshouldCheckSecurity
- if we should check security, default to true- Returns:
- the set of arrays of Membership, Group, and Member
- See Also:
-
findMemberships
public static Set<Object[]> findMemberships(Collection<String> groupIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity, FieldType fieldType, String serviceId, ServiceRole serviceRole) - Parameters:
groupIds
- to limit memberships to (cant have more than 100 bind variables)memberIds
- to limit memberships to (cant have more than 100 bind variables)membershipIds
- to limit memberships to (cant have more than 100 bind variables)membershipType
- Immediate, NonImmediate, etcfield
- if finding one field, list here, otherwise all list fields will be returnedsources
- if limiting memberships of members in certain sources, list herescope
- sql like string which will have a % appended to itstem
- if looking in a certain stemstemScope
- if looking only in this stem, or all substemsenabled
- null for all, true for enabled only, false for disabled onlyshouldCheckSecurity
- if we should check security, default to trueserviceId
- is the id of the service (attributeDefName) if filtering memberships of people in a serviceserviceRole
- is the user/admin role of the user in the service- Returns:
- the set of arrays of Membership, Group, and Member
- See Also:
-
findCompositeMembership
@Deprecated public static Membership findCompositeMembership(GrouperSession s, Group g, Subject subj) throws MembershipNotFoundException, SchemaException Deprecated.see overloadReturn the composite membership if it exists. A composite group is composed of two groups and a set operator (stored in grouper_composites table) (e.g. union, intersection, etc). A composite group has no immediate members. All subjects in a composite group are effective members.- Parameters:
s
- Get membership within this session context.g
- Composite membership has this group.subj
- Composite membership has this subject.- Returns:
- A
Membership
object - Throws:
MembershipNotFoundException
SchemaException
- Since:
- 1.0
-
findCompositeMembership
public static Membership findCompositeMembership(GrouperSession s, Group g, Subject subj, boolean exceptionOnNull) throws MembershipNotFoundException, SchemaException Return the composite membership if it exists. A composite group is composed of two groups and a set operator (stored in grouper_composites table) (e.g. union, intersection, etc). A composite group has no immediate members. All subjects in a composite group are effective members.- Parameters:
s
- Get membership within this session context.g
- Composite membership has this group.subj
- Composite membership has this subject.exceptionOnNull
-- Returns:
- A
Membership
object - Throws:
MembershipNotFoundException
SchemaException
- Since:
- 1.0
-
findEffectiveMemberships
public static Set<Membership> findEffectiveMemberships(GrouperSession s, Group g, Subject subj, Field f, Group via, int depth) throws MembershipNotFoundException, SchemaException Return effective memberships. An effective member has an indirect membership to a group (e.g. in a group within a group). All subjects in a composite group are effective members (since the composite group has two groups and a set operator and no other immediate members). Note that a member can have an immediate membership and an effective membership.- Parameters:
s
- Get membership within this session context.g
- Effective membership has this group.subj
- Effective membership has this subject.f
- Effective membership has this list.via
- Effective membership has this via group.depth
- Effective membership has this depth.- Returns:
- A set of
Membership
objects. - Throws:
MembershipNotFoundException
SchemaException
-
findImmediateMembership
@Deprecated public static Membership findImmediateMembership(GrouperSession s, Group g, Subject subj, Field f) throws MembershipNotFoundException, SchemaException Deprecated.see overloadReturn the immediate membership if it exists. An immediate member is directly assigned to a group. A composite group has no immediate members. Note that a member can have 0 to 1 immediate memberships to a single group, and 0 to many effective memberships to a group. A group can have potentially unlimited effective memberships- Parameters:
s
- Get membership within this session context.g
- Immediate membership has this group.subj
- Immediate membership has this subject.f
- Immediate membership has this list.- Returns:
- A
Membership
object - Throws:
MembershipNotFoundException
SchemaException
-
findImmediateMembership
public static Membership findImmediateMembership(GrouperSession s, Group g, Subject subj, boolean exceptionIfNotFound) throws MembershipNotFoundException, SchemaException Return the immediate membership if it exists. An immediate member is directly assigned to a group. A composite group has no immediate members. Note that a member can have 0 to 1 immediate memberships to a single group, and 0 to many effective memberships to a group. A group can have potentially unlimited effective memberships- Parameters:
s
- Get membership within this session context.g
- Immediate membership has this group.subj
- Immediate membership has this subject.f
- Immediate membership has this list.exceptionIfNotFound
-- Returns:
- A
Membership
object - Throws:
MembershipNotFoundException
SchemaException
-
findImmediateMembership
public static Membership findImmediateMembership(GrouperSession s, Group g, Subject subj, Field f, boolean exceptionIfNotFound) throws MembershipNotFoundException, SchemaException Return the immediate membership if it exists. An immediate member is directly assigned to a group. A composite group has no immediate members. Note that a member can have 0 to 1 immediate memberships to a single group, and 0 to many effective memberships to a group. A group can have potentially unlimited effective memberships- Parameters:
s
- Get membership within this session context.g
- Immediate membership has this group.subj
- Immediate membership has this subject.f
- Immediate membership has this list.exceptionIfNotFound
-- Returns:
- A
Membership
object - Throws:
MembershipNotFoundException
SchemaException
-
findImmediateMembership
public static Membership findImmediateMembership(GrouperSession s, AttributeDef attributeDef, Subject subj, Field f, boolean exceptionIfNotFound) throws MembershipNotFoundException, SchemaException Return the immediate membership if it exists. An immediate member is directly assigned to an attributeDef. An attributeDef can have potentially unlimited effective memberships- Parameters:
s
- Get membership within this session context.SchemaException
- Immediate membership has this attribute def.subj
- Immediate membership has this subject.f
- Immediate membership has this list.exceptionIfNotFound
-- Returns:
- A
Membership
object - Throws:
MembershipNotFoundException
SchemaException
-
internal_findAllChildrenNoPriv
Grouper internal method only
- Parameters:
dto
-- Returns:
- set of memberships
-
findMembers
- Parameters:
group
-field
-- Returns:
- A set of all
Member
's in group's list field. - Throws:
IllegalArgumentException
- if any parameter is null.- Since:
- 1.2.1
-
findMembers
public static Set<Member> findMembers(Group group, Field field, QueryOptions queryOptions) throws IllegalArgumentException - Parameters:
group
-field
-queryOptions
-- Returns:
- A set of all
Member
's in group's list field. - Throws:
IllegalArgumentException
- if any parameter is null.- Since:
- 1.2.1
-
findMembers
public static Set<Member> findMembers(Group group, Field field, Set<Source> sources, QueryOptions queryOptions) throws IllegalArgumentException - Parameters:
group
-field
-sources
- set of sources to retrieve from or null for allqueryOptions
-- Returns:
- A set of all
Member
's in group's list field. - Throws:
IllegalArgumentException
- if any parameter is null.- Since:
- 1.2.1
-
internal_findGroupSubjects
public static Set<Subject> internal_findGroupSubjects(GrouperSession s, Group group, Field f) throws GrouperException Grouper internal method only
- Parameters:
s
-group
-f
-- Returns:
- set of subjects
- Throws:
GrouperException
-
internal_findAttributeDefSubjectsImmediateOnly
public static Set<Subject> internal_findAttributeDefSubjectsImmediateOnly(GrouperSession s, AttributeDef attributeDef, Field f) throws GrouperException Grouper internal method only
- Parameters:
s
-attributeDef
-f
-- Returns:
- set of subjects
- Throws:
GrouperException
-
internal_findStemSubjectsImmediateOnly
public static Set<Subject> internal_findStemSubjectsImmediateOnly(GrouperSession s, Stem stem, Field f) throws GrouperException Grouper internal method only
- Parameters:
s
-stem
-f
-- Returns:
- set of subjects
- Throws:
GrouperException
-
internal_findSubjectsStemPriv
Grouper internal method only
- Parameters:
s
-stem
-f
-- Returns:
- set of subjects
-
internal_findMembersByType
public static Set<Member> internal_findMembersByType(GrouperSession s, Group g, Field f, String type) Grouper internal method only
- Parameters:
s
-g
-f
-type
-- Returns:
- set of members
-
assignScopeForMember
if paging for member, then also filter for member- Parameters:
theFilterForMember
-- Returns:
- this for chaining
-
assignQueryOptionsForGroup
query options for group. must include paging. if sorting then sort by group- Parameters:
theQueryOptionsForGroup
-- Returns:
- this for chaining
-
assignHasFieldForStem
return memberships where the stem has this field, note, it will return all the memberships for those stems- Parameters:
theHasFieldForStem
-- Returns:
- this for chaining
-
assignHasMembershipTypeForStem
return memberships where the stem has this field, note, it will return all the memberships for those stems- Returns:
- this for chaining
-
assignQueryOptionsForStem
query options for stem. must include paging. if sorting then sort by stem- Parameters:
theQueryOptionsForStem
-- Returns:
- this for chaining
-
assignScopeForStem
if paging for stem, then also filter for stem- Parameters:
theScopeForStem
-- Returns:
- this for chaining
-
assignHasFieldForAttributeDef
return memberships where the attributeDef has this field, note, it will return all the memberships for those attributeDefs- Parameters:
theHasFieldForAttributeDef
-- Returns:
- this for chaining
-
assignHasMembershipTypeForAttributeDef
public MembershipFinder assignHasMembershipTypeForAttributeDef(boolean theHasMembershipTypeForAttributeDef) return memberships where the attributeDef has this field, note, it will return all the memberships for those attributeDefs- Parameters:
theHasMembershipTypeForAttributeDef
-- Returns:
- this for chaining
-
assignQueryOptionsForAttributeDef
public MembershipFinder assignQueryOptionsForAttributeDef(QueryOptions theQueryOptionsForAttributeDef) query options for attributeDef. must include paging. if sorting then sort by attributeDef- Parameters:
theQueryOptionsForAttributeDef
-- Returns:
- this for chaining
-
assignScopeForAttributeDef
if paging for attributeDef, then also filter for group- Parameters:
theScopeForAttributeDef
-- Returns:
- this for chaining
-
assignSplitScopeForAttributeDef
if the scope for attributeDef has spaces in it, then split by whitespace, and find results that contain all of the scope strings- Parameters:
theSplitScopeForAttributeDef
-- Returns:
- this
-
assignSplitScopeForStem
if the scope for stem has spaces in it, then split by whitespace, and find results that contain all of the scope strings- Parameters:
theSplitScopeForStem
-- Returns:
- this for chaining
-
assignScopeForGroup
if paging for group, then also filter for member- Parameters:
theScopeForGroup
-- Returns:
- this for chaining
-
assignHasMembershipTypeForGroup
return memberships where the group has this field, note, it will return all the memberships for those groups- Parameters:
theHasMembershipTypeForGroup
-- Returns:
- this for chaining
-
assignSplitScopeForGroup
if the scope for group has spaces in it, then split by whitespace, and find results that contain all of the scope strings- Parameters:
theSplitScopeForGroup
-- Returns:
- this for chaining
-
assignSplitScopeForMember
if the scope for member has spaces in it, then split by whitespace, and find results that contain all of the scope strings- Parameters:
theSplitScopeForMember
-- Returns:
- if splitting scope for member
-
assignQueryOptionsForMember
- Parameters:
theQueryOptions
-- Returns:
-
assignQueryOptionsForMembership
- Parameters:
theQueryOptions
-- Returns:
-
assignPrivilegesTheUserHas
assign a collection of fields to look for the user has for groups- Parameters:
thePrivilegesTheUserHas
-- Returns:
- this for chaining
-
assignPrivilegesTheUserHasByName
public MembershipFinder assignPrivilegesTheUserHasByName(Collection<String> thePrivilegeNamesOfPrivilegesTheUserHas) assign a collection of fields to look for the user has for groups- Parameters:
thePrivilegeNamesOfPrivilegesTheUserHas
-- Returns:
- this for chaining
-
internal_findAllByCreatedAfter
public static Set<Membership> internal_findAllByCreatedAfter(GrouperSession s, Date d, Field f) throws QueryException Grouper internal method only
- Parameters:
s
-d
-f
-- Returns:
- set of memberships
- Throws:
QueryException
-
internal_findAllByCreatedBefore
public static Set<Membership> internal_findAllByCreatedBefore(GrouperSession s, Date d, Field f) throws QueryException Grouper internal method only
- Parameters:
s
-d
-f
-- Returns:
- set of memberships
- Throws:
QueryException
-
internal_findAllByGroupOwnerAndFieldAndType
public static Set<Membership> internal_findAllByGroupOwnerAndFieldAndType(GrouperSession s, Group groupOwner, Field f, String type) Grouper internal method only
- Parameters:
s
-groupOwner
-f
-type
-- Returns:
- set of memberships
-
internal_findAllEffectiveByMemberAndField
public static Set<Membership> internal_findAllEffectiveByMemberAndField(GrouperSession s, Member m, Field f) Grouper internal method only
- Parameters:
s
-m
-f
-- Returns:
- set of memberships
-
internal_findAllImmediateByMemberAndField
public static Set<Membership> internal_findAllImmediateByMemberAndField(GrouperSession s, Member m, Field f) Grouper internal method only
- Parameters:
s
-m
-f
-- Returns:
- set of memberships
-
internal_findAllImmediateByMemberAndField
public static Set<Membership> internal_findAllImmediateByMemberAndField(GrouperSession s, Member m, Field f, boolean enabledOnly) Grouper internal method only
- Parameters:
s
-m
-f
-enabledOnly
-- Returns:
- set of memberships
-
internal_findAllNonImmediateByMemberAndField
public static Set<Membership> internal_findAllNonImmediateByMemberAndField(GrouperSession s, Member m, Field f) Grouper internal method only
- Parameters:
s
-m
-f
-- Returns:
- set of memberships
-
internal_findMemberships
Grouper internal method only
- Parameters:
s
-m
-f
-- Returns:
- set of memberships
-
internal_findAllImmediateByGroupAndFieldAndPage
public static Set<Membership> internal_findAllImmediateByGroupAndFieldAndPage(Group group, Field field, int start, int pageSize, int sortLimit, int[] numberOfRecords) throws SchemaException Grouper internal method only
- Parameters:
start
-pageSize
-group
-field
-sortLimit
-numberOfRecords
- (pass in array of size one to get the result size back)- Returns:
- the set of membership
- Throws:
SchemaException
-
internal_findAllCompositeByGroupAndPage
public static Set<Membership> internal_findAllCompositeByGroupAndPage(Group group, int start, int pageSize, int sortLimit, int[] numberOfRecords) throws SchemaException Grouper internal method only
- Parameters:
start
-pageSize
-group
-sortLimit
-numberOfRecords
- (pass in array of size one to get the result size back)- Returns:
- the set of membership
- Throws:
SchemaException
-
internal_findAllEffectiveByGroupAndFieldAndPage
public static Set<Membership> internal_findAllEffectiveByGroupAndFieldAndPage(Group group, Field field, int start, int pageSize, int sortLimit, int[] numberOfRecords) throws SchemaException Grouper internal method only
- Parameters:
start
-pageSize
-group
-field
-sortLimit
-numberOfRecords
- (pass in array of size one to get the result size back)- Returns:
- the set of membership
- Throws:
SchemaException
-
internal_findAllByGroupAndFieldAndPage
public static Set<Membership> internal_findAllByGroupAndFieldAndPage(Group group, Field field, int start, int pageSize, int sortLimit, int[] numberOfRecords) throws SchemaException Grouper internal method only
- Parameters:
start
-pageSize
-group
-field
-sortLimit
-numberOfRecords
- (pass in array of size one to get the result size back)- Returns:
- the set of membership
- Throws:
SchemaException
-
internal_findAttributeDefSubjects
public static Set<Subject> internal_findAttributeDefSubjects(GrouperSession s, AttributeDef attributeDef, Field f) throws GrouperException Grouper internal method only
- Parameters:
s
-attributeDef
-f
-- Returns:
- set of subjects
- Throws:
GrouperException
-
internal_findGroupSubjectsImmediateOnly
public static Set<Subject> internal_findGroupSubjectsImmediateOnly(GrouperSession s, Group group, Field f) throws GrouperException Grouper internal method only
- Parameters:
s
-group
-f
-- Returns:
- set of subjects
- Throws:
GrouperException
-
findByUuid
public static Membership findByUuid(GrouperSession grouperSession, String uuid, boolean exceptionIfNotFound, boolean enabledOnly) throws MembershipNotFoundException Find a membership within the registry by UUID. This will be either the uuid or immediate uuid. Security will be checked to see if the grouper session is allowed to see the membershipMembership membership = MembershipFinder.findByUuid(grouperSession, uuid);
- Parameters:
grouperSession
- Find membership within this session context.uuid
- UUID of membership to find.exceptionIfNotFound
- true if exception if not foundenabledOnly
- true for enabled only- Returns:
- A
Membership
- Throws:
MembershipNotFoundException
- if not found an exceptionIfNotFound is true
-
findAllImmediateMemberhipSubjectContainers
public static Set<MembershipSubjectContainer> findAllImmediateMemberhipSubjectContainers(GrouperSession grouperSession, Subject subject) Find all the membership subject containers for a given subject- Parameters:
grouperSession
-subject
-- Returns:
-