use of org.olat.basesecurity.IdentityRef in project OpenOLAT by OpenOLAT.
the class RepositoryEntryMembershipProcessor method processIdentityRemoved.
private void processIdentityRemoved(Long repoKey, Long identityKey) {
IdentityRef identity = new IdentityRefImpl(identityKey);
RepositoryEntryRef re = new RepositoryEntryRefImpl(repoKey);
List<String> remainingRoles = repositoryEntryRelationDao.getRoles(identity, re);
if (remainingRoles.isEmpty()) {
OLATResource resource = repositoryManager.lookupRepositoryEntryResource(repoKey);
notificationsManager.unsubscribeAllForIdentityAndResId(identity, resource.getResourceableId());
}
}
use of org.olat.basesecurity.IdentityRef in project OpenOLAT by OpenOLAT.
the class LDAPLoginManagerImpl method doSyncGroupByAttribute.
private void doSyncGroupByAttribute(List<LDAPUser> ldapUsers, Map<String, LDAPGroup> cnToGroupMap) {
for (LDAPUser ldapUser : ldapUsers) {
List<String> groupIds = ldapUser.getGroupIds();
List<String> coachedGroupIds = ldapUser.getCoachedGroupIds();
if ((groupIds != null && groupIds.size() > 0) || (coachedGroupIds != null && coachedGroupIds.size() > 0)) {
IdentityRef identity = ldapUser.getCachedIdentity();
if (identity == null) {
log.error("Identity with dn=" + ldapUser.getDn() + " not found");
} else {
if (groupIds != null && groupIds.size() > 0) {
for (String groupId : groupIds) {
if (!cnToGroupMap.containsKey(groupId)) {
cnToGroupMap.put(groupId, new LDAPGroup(groupId));
}
cnToGroupMap.get(groupId).getParticipants().add(ldapUser);
}
}
if (coachedGroupIds != null && coachedGroupIds.size() > 0) {
for (String coachedGroupId : coachedGroupIds) {
if (!cnToGroupMap.containsKey(coachedGroupId)) {
cnToGroupMap.put(coachedGroupId, new LDAPGroup(coachedGroupId));
}
cnToGroupMap.get(coachedGroupId).getCoaches().add(ldapUser);
}
}
}
}
}
}
use of org.olat.basesecurity.IdentityRef in project OpenOLAT by OpenOLAT.
the class GTACoachedParticipantListController method updateModel.
protected void updateModel(UserRequest ureq) {
RepositoryEntry entry = courseEnv.getCourseGroupManager().getCourseEntry();
List<TaskLight> tasks = gtaManager.getTasksLight(entry, gtaNode);
Map<Long, TaskLight> identityToTasks = new HashMap<>(tasks.size());
for (TaskLight task : tasks) {
if (task.getIdentityKey() != null) {
identityToTasks.put(task.getIdentityKey(), task);
}
}
List<IdentityMark> marks = gtaManager.getMarks(entry, gtaNode, ureq.getIdentity());
Map<Long, IdentityMark> identityToMarks = new HashMap<>(marks.size());
for (IdentityMark mark : marks) {
if (mark.getParticipant() != null) {
identityToMarks.put(mark.getParticipant().getKey(), mark);
}
}
List<AssessmentEntry> assessments = assessmentService.loadAssessmentEntriesBySubIdent(entry, gtaNode.getIdent());
Map<Long, AssessmentEntry> identityToAssessments = new HashMap<>(assessments.size());
for (AssessmentEntry assessment : assessments) {
if (assessment.getIdentity() != null) {
identityToAssessments.put(assessment.getIdentity().getKey(), assessment);
}
}
List<CoachedIdentityRow> rows = new ArrayList<>(assessableIdentities.size());
for (UserPropertiesRow assessableIdentity : assessableIdentities) {
IdentityMark mark = identityToMarks.get(assessableIdentity.getIdentityKey());
if (markedOnly && mark == null)
continue;
FormLink markLink = uifactory.addFormLink("mark_" + assessableIdentity.getIdentityKey(), "mark", "", null, null, Link.NONTRANSLATED);
markLink.setIconLeftCSS(mark != null ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
markLink.setUserObject(assessableIdentity.getIdentityKey());
TaskLight task = identityToTasks.get(assessableIdentity.getIdentityKey());
Date submissionDueDate = null;
if (task == null || task.getTaskStatus() == null || task.getTaskStatus() == TaskProcess.assignment) {
IdentityRef identityRef = new IdentityRefImpl(assessableIdentity.getIdentityKey());
DueDate dueDate = gtaManager.getSubmissionDueDate(task, identityRef, null, gtaNode, entry, true);
if (dueDate != null) {
submissionDueDate = dueDate.getDueDate();
}
}
Date syntheticSubmissionDate = null;
boolean hasSubmittedDocument = false;
if (task != null && task.getTaskStatus() != null && task.getTaskStatus() != TaskProcess.assignment && task.getTaskStatus() != TaskProcess.submit) {
syntheticSubmissionDate = getSyntheticSubmissionDate(task);
if (syntheticSubmissionDate != null) {
hasSubmittedDocument = hasSubmittedDocument(task);
}
}
int numSubmittedDocs = task != null && task.getSubmissionNumOfDocs() != null ? task.getSubmissionNumOfDocs() : 0;
AssessmentEntry assessment = identityToAssessments.get(assessableIdentity.getIdentityKey());
Boolean userVisibility = assessment != null ? assessment.getUserVisibility() : null;
BigDecimal score = assessment != null ? assessment.getScore() : null;
Boolean passed = assessment != null ? assessment.getPassed() : null;
rows.add(new CoachedIdentityRow(assessableIdentity, task, submissionDueDate, syntheticSubmissionDate, hasSubmittedDocument, markLink, userVisibility, score, passed, numSubmittedDocs));
}
tableModel.setObjects(rows);
tableEl.reset();
}
use of org.olat.basesecurity.IdentityRef in project OpenOLAT by OpenOLAT.
the class IdentityListCourseNodeController method getSelectedIdentities.
@Override
public List<IdentityRef> getSelectedIdentities() {
Set<Integer> selections = tableEl.getMultiSelectedIndex();
List<AssessedIdentityElementRow> rows = new ArrayList<>(selections.size());
for (Integer i : selections) {
AssessedIdentityElementRow row = usersTableModel.getObject(i.intValue());
if (row != null && row.getAssessmentStatus() != AssessmentEntryStatus.done) {
rows.add(row);
}
}
if (rows == null || rows.isEmpty()) {
return Collections.emptyList();
}
List<IdentityRef> selectedIdentities = new ArrayList<>();
for (AssessedIdentityElementRow row : rows) {
selectedIdentities.add(new IdentityRefImpl(row.getIdentityKey()));
}
return selectedIdentities;
}
use of org.olat.basesecurity.IdentityRef in project OpenOLAT by OpenOLAT.
the class BusinessGroupMembershipProcessor method processIdentityRemoved.
private void processIdentityRemoved(Long groupKey, Long identityKey) {
IdentityRef identityRef = new IdentityRefImpl(identityKey);
BusinessGroupRef groupRef = new BusinessGroupRefImpl(groupKey);
if (!businessGroupRelationDao.hasAnyRole(identityRef, groupRef)) {
infoMessageManager.updateInfoMessagesOfIdentity(groupRef, identityRef);
notificationsManager.unsubscribeAllForIdentityAndResId(identityRef, groupRef.getKey());
List<BGRepositoryEntryRelation> relations = businessGroupRelationDao.findRelationToRepositoryEntries(Collections.singletonList(groupKey), 0, -1);
for (BGRepositoryEntryRelation relation : relations) {
Long repositoryEntryKey = relation.getRepositoryEntryKey();
RepositoryEntryRef entryRef = new RepositoryEntryRefImpl(repositoryEntryKey);
List<String> remaingRoles = repositoryEntryRelationDao.getRoles(identityRef, entryRef);
if (remaingRoles.isEmpty()) {
OLATResource resource = repositoryManager.lookupRepositoryEntryResource(entryRef.getKey());
notificationsManager.unsubscribeAllForIdentityAndResId(identityRef, resource.getResourceableId());
}
}
}
}
Aggregations