private boolean isCurrentUserFromGroup(final String gradebookUid, final String studentId) { boolean isFromGroup = false; try { final Site s = this.siteService.getSite(gradebookUid); final Group g = s.getGroup(studentId); isFromGroup = (g != null) && (g.getMember(this.authn.getUserUid()) != null); } catch (final Exception e) { // Id not found log.error("Error in isCurrentUserFromGroup: ", e); } return isFromGroup; }
private boolean isCurrentUserFromGroup(final String gradebookUid, final String studentId) { boolean isFromGroup=false; try { final Site s = this.siteService.getSite(gradebookUid); final Group g = s.getGroup(studentId); isFromGroup = (g != null) && (g.getMember(this.authn.getUserUid()) != null); } catch (final Exception e) { // Id not found log.error("Error in isCurrentUserFromGroup: ", e); } return isFromGroup; }
/** * {@inheritDoc} */ public Collection getGroupsWithMemberHasRole(String userId, String role) { Collection siteGroups = getGroups(); ArrayList<String> siteGroupRefs = new ArrayList<String>(siteGroups.size()); for ( Iterator it=siteGroups.iterator(); it.hasNext(); ) siteGroupRefs.add( ((Group)it.next()).getReference() ); List groups = authzGroupService.getAuthzUserGroupIds(siteGroupRefs, userId); Collection<Group> rv = new Vector<Group>(); for (Iterator i = groups.iterator(); i.hasNext();) { Member m = null; Group g = getGroup( (String)i.next() ); if ( g != null ) m = g.getMember(userId); if ((m != null) && (m.isActive()) && (m.getRole().getId().equals(role))) rv.add(g); } return rv; }
/** * Determine if current user can access this group restricted entity */ public boolean canAccessViaGroups(Collection groups, String siteId) { final String userId = sessionManager.getCurrentSessionUserId(); Site site = null; try { site = siteService.getSite(siteId); } catch (IdUnusedException e) { // Mucho Weirdness since called from within tool which should // pass the correct id. But if an error return false; } for (Iterator groupIter = groups.iterator(); groupIter.hasNext();) { final String currentGroupId = (String) groupIter.next(); final Group currentGroup = site.getGroup(currentGroupId); if (currentGroup != null) { final Member member = currentGroup.getMember(userId); if (member != null && member.getUserId().equals(userId)) { return true; } } } return false; }
m = g.getMember(userIds[j]); if ((m == null) || (!m.isActive()))
try { notAllowed = st.getGroup(submission.getSubmitterId()).getMember(currentUser.getId()) == null; } catch (Throwable _sss) { }