Search in sources :

Example 16 with IdentityRefImpl

use of org.olat.basesecurity.model.IdentityRefImpl 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());
            }
        }
    }
}
Also used : IdentityRefImpl(org.olat.basesecurity.model.IdentityRefImpl) BusinessGroupRef(org.olat.group.BusinessGroupRef) IdentityRef(org.olat.basesecurity.IdentityRef) RepositoryEntryRefImpl(org.olat.repository.model.RepositoryEntryRefImpl) OLATResource(org.olat.resource.OLATResource) BusinessGroupRefImpl(org.olat.group.model.BusinessGroupRefImpl) RepositoryEntryRef(org.olat.repository.RepositoryEntryRef) BGRepositoryEntryRelation(org.olat.group.model.BGRepositoryEntryRelation)

Example 17 with IdentityRefImpl

use of org.olat.basesecurity.model.IdentityRefImpl in project openolat by klemens.

the class DownloadCertificateCellRenderer method render.

@Override
public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator translator) {
    if (renderer == null) {
        if (cellValue instanceof CertificateLight) {
            renderExcel(target, (CertificateLight) cellValue);
        } else if (cellValue instanceof CertificateLightPack) {
            CertificateLightPack pack = (CertificateLightPack) cellValue;
            renderExcel(target, pack.getCertificate());
        }
    } else if (cellValue instanceof CertificateLight) {
        CertificateLight certificate = (CertificateLight) cellValue;
        if (assessedIdentity == null) {
            IdentityRef idRef = new IdentityRefImpl(certificate.getIdentityKey());
            render(target, certificate, idRef, translator.getLocale());
        } else {
            render(target, certificate, assessedIdentity, translator.getLocale());
        }
    } else if (cellValue instanceof CertificateLightPack) {
        CertificateLightPack pack = (CertificateLightPack) cellValue;
        render(target, pack.getCertificate(), pack.getIdentity(), translator.getLocale());
    }
}
Also used : IdentityRefImpl(org.olat.basesecurity.model.IdentityRefImpl) CertificateLightPack(org.olat.course.certificate.model.CertificateLightPack) IdentityRef(org.olat.basesecurity.IdentityRef) CertificateLight(org.olat.course.certificate.CertificateLight)

Example 18 with IdentityRefImpl

use of org.olat.basesecurity.model.IdentityRefImpl in project openolat by klemens.

the class BusinessGroupMembershipProcessor method processResourceRemoved.

private void processResourceRemoved(Long groupKey, Long repoKey) {
    BusinessGroupRef groupRef = new BusinessGroupRefImpl(groupKey);
    RepositoryEntryRef entryRef = new RepositoryEntryRefImpl(repoKey);
    OLATResource resource = repositoryManager.lookupRepositoryEntryResource(entryRef.getKey());
    List<Long> memberKeys = businessGroupRelationDao.getMemberKeys(Collections.singletonList(groupRef), GroupRoles.coach.name(), GroupRoles.participant.name());
    for (Long memberKey : memberKeys) {
        IdentityRef member = new IdentityRefImpl(memberKey);
        List<String> remaingRoles = repositoryEntryRelationDao.getRoles(member, entryRef);
        if (remaingRoles.isEmpty()) {
            notificationsManager.unsubscribeAllForIdentityAndResId(member, resource.getResourceableId());
        }
    }
}
Also used : BusinessGroupRef(org.olat.group.BusinessGroupRef) IdentityRefImpl(org.olat.basesecurity.model.IdentityRefImpl) RepositoryEntryRefImpl(org.olat.repository.model.RepositoryEntryRefImpl) IdentityRef(org.olat.basesecurity.IdentityRef) OLATResource(org.olat.resource.OLATResource) BusinessGroupRefImpl(org.olat.group.model.BusinessGroupRefImpl) RepositoryEntryRef(org.olat.repository.RepositoryEntryRef)

Aggregations

IdentityRef (org.olat.basesecurity.IdentityRef)18 IdentityRefImpl (org.olat.basesecurity.model.IdentityRefImpl)18 ArrayList (java.util.ArrayList)8 BusinessGroupRef (org.olat.group.BusinessGroupRef)6 RepositoryEntryRef (org.olat.repository.RepositoryEntryRef)6 RepositoryEntryRefImpl (org.olat.repository.model.RepositoryEntryRefImpl)6 OLATResource (org.olat.resource.OLATResource)6 HashMap (java.util.HashMap)4 BusinessGroupRefImpl (org.olat.group.model.BusinessGroupRefImpl)4 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)4 BigDecimal (java.math.BigDecimal)2 Date (java.util.Date)2 Map (java.util.Map)2 AuthenticationException (javax.naming.AuthenticationException)2 NamingException (javax.naming.NamingException)2 Attributes (javax.naming.directory.Attributes)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 Identity (org.olat.core.id.Identity)2 CertificateLight (org.olat.course.certificate.CertificateLight)2 CertificateLightPack (org.olat.course.certificate.model.CertificateLightPack)2