Search in sources :

Example 1 with TaxonomyRef

use of org.olat.modules.taxonomy.TaxonomyRef in project OpenOLAT by OpenOLAT.

the class DocumentPoolSiteSecurityCallback method isAllowedToLaunchSite.

/**
 * @see com.frentix.olat.coursesite.SiteSecurityCallback#isAllowedToLaunchSite(org.olat.core.gui.UserRequest)
 */
@Override
public boolean isAllowedToLaunchSite(UserRequest ureq) {
    UserSession usess = ureq == null ? null : ureq.getUserSession();
    if (usess == null)
        return false;
    Roles roles = usess.getRoles();
    if (roles == null || roles.isInvitee() || roles.isGuestOnly()) {
        return false;
    }
    if (roles.isOLATAdmin()) {
        return true;
    }
    String taxonomyKey = docPoolModule.getTaxonomyTreeKey();
    if (StringHelper.isLong(taxonomyKey)) {
        TaxonomyRef taxonomy = new TaxonomyRefImpl(new Long(taxonomyKey));
        return taxonomyService.hasTaxonomyCompetences(taxonomy, ureq.getIdentity(), ureq.getRequestTimestamp());
    }
    return false;
}
Also used : TaxonomyRefImpl(org.olat.modules.taxonomy.model.TaxonomyRefImpl) TaxonomyRef(org.olat.modules.taxonomy.TaxonomyRef) UserSession(org.olat.core.util.UserSession) Roles(org.olat.core.id.Roles)

Example 2 with TaxonomyRef

use of org.olat.modules.taxonomy.TaxonomyRef in project openolat by klemens.

the class DocumentPoolSiteSecurityCallback method isAllowedToLaunchSite.

/**
 * @see com.frentix.olat.coursesite.SiteSecurityCallback#isAllowedToLaunchSite(org.olat.core.gui.UserRequest)
 */
@Override
public boolean isAllowedToLaunchSite(UserRequest ureq) {
    UserSession usess = ureq == null ? null : ureq.getUserSession();
    if (usess == null)
        return false;
    Roles roles = usess.getRoles();
    if (roles == null || roles.isInvitee() || roles.isGuestOnly()) {
        return false;
    }
    if (roles.isOLATAdmin()) {
        return true;
    }
    String taxonomyKey = docPoolModule.getTaxonomyTreeKey();
    if (StringHelper.isLong(taxonomyKey)) {
        TaxonomyRef taxonomy = new TaxonomyRefImpl(new Long(taxonomyKey));
        return taxonomyService.hasTaxonomyCompetences(taxonomy, ureq.getIdentity(), ureq.getRequestTimestamp());
    }
    return false;
}
Also used : TaxonomyRefImpl(org.olat.modules.taxonomy.model.TaxonomyRefImpl) TaxonomyRef(org.olat.modules.taxonomy.TaxonomyRef) UserSession(org.olat.core.util.UserSession) Roles(org.olat.core.id.Roles)

Example 3 with TaxonomyRef

use of org.olat.modules.taxonomy.TaxonomyRef in project OpenOLAT by OpenOLAT.

the class PoolTaxonomySecurityCallback method isAllowedToLaunchSite.

@Override
public boolean isAllowedToLaunchSite(UserRequest ureq) {
    if (!questionPoolModule.isEnabled() || !StringHelper.isLong(questionPoolModule.getTaxonomyQPoolKey()) || ureq == null || ureq.getIdentity() == null) {
        return false;
    }
    UserSession usess = ureq.getUserSession();
    if (usess == null) {
        return false;
    }
    Roles roles = usess.getRoles();
    if (roles == null || roles.isInvitee() || roles.isGuestOnly()) {
        return false;
    }
    if (roles.isOLATAdmin() || roles.isPoolAdmin()) {
        return true;
    }
    TaxonomyCompetenceTypes[] types = new TaxonomyCompetenceTypes[] { TaxonomyCompetenceTypes.manage, TaxonomyCompetenceTypes.teach };
    TaxonomyRef taxonomy = new TaxonomyRefImpl(Long.valueOf(questionPoolModule.getTaxonomyQPoolKey()));
    return taxonomyService.hasTaxonomyCompetences(taxonomy, ureq.getIdentity(), new Date(), types);
}
Also used : TaxonomyRefImpl(org.olat.modules.taxonomy.model.TaxonomyRefImpl) TaxonomyRef(org.olat.modules.taxonomy.TaxonomyRef) UserSession(org.olat.core.util.UserSession) Roles(org.olat.core.id.Roles) TaxonomyCompetenceTypes(org.olat.modules.taxonomy.TaxonomyCompetenceTypes) Date(java.util.Date)

Example 4 with TaxonomyRef

use of org.olat.modules.taxonomy.TaxonomyRef in project openolat by klemens.

the class PoolTaxonomySecurityCallback method isAllowedToLaunchSite.

@Override
public boolean isAllowedToLaunchSite(UserRequest ureq) {
    if (!questionPoolModule.isEnabled() || !StringHelper.isLong(questionPoolModule.getTaxonomyQPoolKey()) || ureq == null || ureq.getIdentity() == null) {
        return false;
    }
    UserSession usess = ureq.getUserSession();
    if (usess == null) {
        return false;
    }
    Roles roles = usess.getRoles();
    if (roles == null || roles.isInvitee() || roles.isGuestOnly()) {
        return false;
    }
    if (roles.isOLATAdmin() || roles.isPoolAdmin()) {
        return true;
    }
    TaxonomyCompetenceTypes[] types = new TaxonomyCompetenceTypes[] { TaxonomyCompetenceTypes.manage, TaxonomyCompetenceTypes.teach };
    TaxonomyRef taxonomy = new TaxonomyRefImpl(Long.valueOf(questionPoolModule.getTaxonomyQPoolKey()));
    return taxonomyService.hasTaxonomyCompetences(taxonomy, ureq.getIdentity(), new Date(), types);
}
Also used : TaxonomyRefImpl(org.olat.modules.taxonomy.model.TaxonomyRefImpl) TaxonomyRef(org.olat.modules.taxonomy.TaxonomyRef) UserSession(org.olat.core.util.UserSession) Roles(org.olat.core.id.Roles) TaxonomyCompetenceTypes(org.olat.modules.taxonomy.TaxonomyCompetenceTypes) Date(java.util.Date)

Aggregations

Roles (org.olat.core.id.Roles)4 UserSession (org.olat.core.util.UserSession)4 TaxonomyRef (org.olat.modules.taxonomy.TaxonomyRef)4 TaxonomyRefImpl (org.olat.modules.taxonomy.model.TaxonomyRefImpl)4 Date (java.util.Date)2 TaxonomyCompetenceTypes (org.olat.modules.taxonomy.TaxonomyCompetenceTypes)2