/** * Given a Subject id and SubjectType return a Subject - or null if one * not found * * @param subjectId Subject id * @param subjectType Subject type * @return Subject */ public static Subject getSubjectFromIdAndType(String subjectId, String subjectType) { try { return SubjectFinder.findById(subjectId, subjectType); } catch (Exception e) { } return null; }
String sourceId = matcher.group(1); String subjectId = matcher.group(2); return SubjectFinder.findByIdAndSource(subjectId, sourceId, exceptionIfNotFound); return SubjectFinder.findByIdOrIdentifier(searchString, exceptionIfNotFound); } catch (SubjectNotUniqueException snue) { if (exceptionIfNotFound) {
/** * Remove GrouperAll and GrouperSystem from the returned subjects. * * @param subjects * @return the filtered set of subjects */ public Set<Subject> filterInternalSubjects(Set<Subject> subjects) { // filter GrouperSystem if (subjects.contains(SubjectFinder.findRootSubject())) { subjects.remove(SubjectFinder.findRootSubject()); } // filter GrouperAll if (subjects.contains(SubjectFinder.findAllSubject())) { subjects.remove(SubjectFinder.findAllSubject()); } return subjects; }
public Object callback(GrouperSession theGrouperSession) throws GrouperSessionException { try { //see if across all sources if (SOURCE_ID == null) { return SubjectFinder.findByIdOrIdentifier(USER_ID_LOGGED_IN, true); } //see if in specified sources String[] sourceIds = GrouperUtil.splitTrim(SOURCE_ID, ","); for (String curSource : sourceIds) { Subject s = SubjectFinder.findByIdOrIdentifierAndSource(USER_ID_LOGGED_IN, curSource, false); if (s != null) { return s; } } throw new SubjectNotFoundException("Unable to find subject in source type(s): " + SOURCE_ID); } catch (Exception e) { //this is probably a system error... not a user error throw new RuntimeException("Cant find subject from login id: " + USER_ID_LOGGED_IN, e); } } });
this.subject = SubjectFinder.findByIdOrIdentifierAndSource(this.subjectId, this.subjectSourceId, true); return; this.subject = SubjectFinder.findByIdOrIdentifier(this.subjectId, true); this.subject = SubjectFinder.getSource(this.subjectSourceId).getSubject( this.subjectId, true); return; this.subject = SubjectFinder.findById(this.subjectId, true); return; } else if (hasSubjectIdentifier) { this.subject = SubjectFinder.getSource(this.subjectSourceId).getSubjectByIdentifier( this.subjectIdentifier, true); return; this.subject = SubjectFinder.findByIdentifier(this.subjectIdentifier, true); return; this.subject = SubjectFinder.findByIdOrIdentifierAndSource(loginId, ExternalSubject.sourceId(), false); if (this.subject == null) { this.subject = SubjectFinder.findByIdOrIdentifier(loginId, false); this.subject = SubjectFinder.findByIdAndSource(externalSubject.getUuid(), ExternalSubject.sourceId(), false); if (this.subject == null) { this.subjectFindResult = SubjectFindResult.SUBJECT_NOT_FOUND;
Subject subject = SubjectFinder.findByIdAndSource(subjectIdOrIdentifier, sourceId, true); loaderReport.append("<font color='green'>SUCCESS:</font> Found subject '" + subjectIdOrIdentifier + "' in source: '" + sourceId + "' by id: " + GrouperUtil.subjectToString(subject) + "\n"); Subject subject = SubjectFinder.findById(subjectIdOrIdentifier, true); loaderReport.append("<font color='green'>SUCCESS:</font> Found subject '" + subjectIdOrIdentifier + "' by id: " + GrouperUtil.subjectToString(subject) + "\n"); Subject subject = SubjectFinder.findByIdentifierAndSource(subjectIdOrIdentifier, sourceId, true); loaderReport.append("<font color='green'>SUCCESS:</font> Found subject '" + subjectIdOrIdentifier + "' in source: '" + sourceId + "' by identifier: " + GrouperUtil.subjectToString(subject) + "\n"); Subject subject = SubjectFinder.findByIdentifier(subjectIdOrIdentifier, true); loaderReport.append("<font color='green'>SUCCESS:</font> Found subject '" + subjectIdOrIdentifier + "' by identifier: " + GrouperUtil.subjectToString(subject) + "\n"); Subject subject = SubjectFinder.findByIdOrIdentifierAndSource(subjectIdOrIdentifier, sourceId, true); loaderReport.append("<font color='green'>SUCCESS:</font> Found subject '" + subjectIdOrIdentifier + "' in source: '" + sourceId + "' by idOrIdentifier: " + GrouperUtil.subjectToString(subject) + "\n"); Subject subject = SubjectFinder.findByIdOrIdentifier(subjectIdOrIdentifier, true); loaderReport.append("<font color='green'>SUCCESS:</font> Found subject '" + subjectIdOrIdentifier + "' by idOrIdentifier: " + GrouperUtil.subjectToString(subject) + "\n");
String theSourceId = GrouperUtil.prefixOrSuffix(actAsComboName, "||", true); String theSubjectId = GrouperUtil.prefixOrSuffix(actAsComboName, "||", false); actAsSubject = SubjectFinder.findByIdOrIdentifierAndSource(theSubjectId, theSourceId, true); } else { actAsSubject = SubjectFinder.findByIdOrIdentifierAndSource(actAsComboName, SubjectHelper.nonGroupSources(), true); Subject subject = null; try { subject = SubjectFinder.findByIdAndSource(subjectId, sourceId, false); theSubject = subject; } catch (Exception e) { Subject subject = null; try { subject = SubjectFinder.findByIdentifierAndSource(subjectIdentifier, sourceId, false); if (theSubject == null) { theSubject = subject; Set<Subject> subjects = null; try { subjects = SubjectFinder.findAll(searchString, sourceId); subjectsSearch = subjects; if (theSubject == null && GrouperUtil.length(subjects) > 0) { SearchPageResult searchPageResult = null; try { searchPageResult = SubjectFinder.findPage(searchString, sourceId); if (searchPageResult != null) { subjects = searchPageResult.getResults();
Set<String> searchStrings = GrouperUtil.splitTrimToSet(searchString, ","); if (StringUtils.equals("all", sourceId)) { subjects = new LinkedHashSet<Subject>(GrouperUtil.nonNull(SubjectFinder.findByIdsOrIdentifiers(searchStrings, GrouperDeprovisioningSettings.retrieveSourcesAllowedToDeprovision())).values()); } else { subjects = new LinkedHashSet<Subject>(GrouperUtil.nonNull(SubjectFinder.findByIdsOrIdentifiers(searchStrings, sourceId)).values()); if (StringUtils.equals("all", sourceId)) { try { subject = SubjectFinder.findByIdOrIdentifier(searchString, false); } catch (SubjectNotUniqueException snue) { subject = SubjectFinder.findByIdOrIdentifierAndSource(searchString, sourceId, false); sources = GrouperUtil.toSet(SourceManager.getInstance().getSource(sourceId)); subjects = SubjectFinder.findPage(searchString, sources).getResults();
Subject rootSubject = SubjectFinder.findRootSubject(); actAsSubject = SubjectFinder.findByIdAndSource(grouperActAsSubjectId, grouperActAsSubjectSource, true); } else if (!StringUtils.isBlank(grouperActAsSubjectIdentifier)) { actAsSubject = SubjectFinder.findByIdentifierAndSource(grouperActAsSubjectIdentifier, grouperActAsSubjectSource, true); } else { throw new RuntimeException("Why am I here?");
subject = SubjectFinder.findById(this.subjectId, true); this.sourceId = subject.getSource().getId(); subject = SubjectFinder.findById(this.subjectId, true); } else if (hasSubjectIdentifier) { subject = SubjectFinder.findByIdentifier(subjectIdentifier, true); } else if (hasSubjectIdOrIdentifier) { subject = SubjectFinder.findByIdOrIdentifier(theSubjectIdOrIdentifier, true); } else { throw new RuntimeException("Should not get here either");
subject = SubjectFinder.findByIdAndSource(principalName, sourceId, false); } else { subject = SubjectFinder.findById(principalName, false);
Subject subjectToAssign = SubjectFinder.findByIdOrIdentifierAndSource(loginId, ExternalSubject.sourceId(), false); if (subjectToAssign == null) { try { subjectToAssign = SubjectFinder.findByIdOrIdentifier(loginId, false); } catch (SubjectNotUniqueException snue) { subjectToAssign = SubjectFinder.findByIdAndSource(externalSubject.getUuid(), ExternalSubject.sourceId(), true);
subject=SubjectFinder.findById(id, true); }else{ subject=SubjectFinder.findByIdentifier(id, true);
if (fieldIdentifier.getSource().equals(SubjectFinder.internal_getGSA().getId())) { SubjectFinder.getSource(fieldIdentifier.getSource());
public MemberSourceFilter(String sourceId) { this.sourceId = sourceId; // test to see if source is available, will throw exceptions if not SubjectFinder.getSource(sourceId); }
public boolean isValid(GrouperSession s, Map menuItem, HttpServletRequest request) { boolean isRoot=s.getSubject().equals(SubjectFinder.findRootSubject()) || Boolean.TRUE.equals(request.getSession().getAttribute("activeWheelGroupMember")); if("true".equals(menuItem.get("forAdmin")) && !isRoot) return false; if("false".equals(menuItem.get("forAdmin")) && isRoot) return false; return true; }
/** * if the group has admin granted to all * @return true */ public boolean isGrantAllAdmin() { return this.group.hasAdmin(SubjectFinder.findAllSubject()); }
Subject subject = SubjectFinder.findByIdAndSource(subjectId, sourceId, false); if (subject == null) { return Collections.EMPTY_MAP;
/** * */ @Override public Collection<Subject> search(HttpServletRequest localRequest, GrouperSession grouperSession, String query) { Group group = UiV2Group.retrieveGroupHelper(localRequest, AccessPrivilege.UPDATE, false).getGroup(); String stemName = null; if (group == null) { Stem stem = UiV2Stem.retrieveStemHelper(localRequest, true, false, false).getStem(); stemName = stem == null ? null : stem.getName(); } else { stemName = group.getParentStemName(); } try { GrouperSourceAdapter.searchForGroupsWithReadPrivilege(true); Collection<Subject> results = StringUtils.isBlank(stemName) ? SubjectFinder.findPage(query).getResults() : SubjectFinder.findPageInStem(stemName, query).getResults(); return results; } finally { GrouperSourceAdapter.clearSearchForGroupsWithReadPrivilege(); } }
/** * */ @Override public Collection<Subject> search(HttpServletRequest localRequest, GrouperSession grouperSession, String query) { try { GrouperSourceAdapter.searchForGroupsWithReadPrivilege(true); Collection<Subject> results = SubjectFinder.findPage(query, GrouperDeprovisioningSettings.retrieveSourcesAllowedToDeprovision()).getResults(); return results; } finally { GrouperSourceAdapter.clearSearchForGroupsWithReadPrivilege(); } }