use of org.olat.modules.taxonomy.TaxonomyCompetenceTypes in project OpenOLAT by OpenOLAT.
the class TaxonomyCompetenceTypeRenderer method render.
@Override
public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator trans) {
if (cellValue instanceof TaxonomyCompetenceTypes) {
TaxonomyCompetenceTypes type = (TaxonomyCompetenceTypes) cellValue;
target.append(translator.translate(type.name()));
}
}
use of org.olat.modules.taxonomy.TaxonomyCompetenceTypes in project OpenOLAT by OpenOLAT.
the class IdentityCompetenceRow method isManaged.
public boolean isManaged() {
TaxonomyLevel level = competence.getTaxonomyLevel();
TaxonomyCompetenceTypes competenceType = competence.getCompetenceType();
TaxonomyLevelManagedFlag marker = TaxonomyLevelManagedFlag.getCorrespondingFlag(competenceType);
return TaxonomyLevelManagedFlag.isManaged(level, marker);
}
use of org.olat.modules.taxonomy.TaxonomyCompetenceTypes in project OpenOLAT by OpenOLAT.
the class TaxonomyTreeBuilder method computePermissionsRecursive.
private void computePermissionsRecursive(TaxonomyTreeNode node, Map<TaxonomyLevel, List<TaxonomyCompetenceTypes>> levelToCompetences) {
boolean hasRead = node.isCanRead();
boolean hasWrite = node.isCanWrite();
if (node.getType() == TaxonomyTreeNodeType.lostAndFound) {
hasRead = isTaxonomyAdmin;
hasWrite = isTaxonomyAdmin;
node.setCanRead(hasRead);
node.setCanWrite(hasWrite);
} else if (node.getTaxonomyLevel() != null) {
TaxonomyLevel level = node.getTaxonomyLevel();
TaxonomyLevelType type = level.getType();
if (type != null) {
List<TaxonomyCompetenceTypes> competences = levelToCompetences.get(level);
if (competences != null && competences.size() > 0) {
for (TaxonomyCompetenceTypes competence : competences) {
hasRead |= hasReadAccess(type, competence);
hasWrite |= hasWriteAccess(type, competence);
if (competence == TaxonomyCompetenceTypes.teach && type.getDocumentsLibraryTeachCompetenceReadParentLevels() > 0) {
int parentLevels = type.getDocumentsLibraryTeachCompetenceReadParentLevels();
TaxonomyTreeNode parent = (TaxonomyTreeNode) node.getParent();
for (int i = parentLevels; i-- > 0 && parent != null; ) {
parent.setCanRead(true);
parent = (TaxonomyTreeNode) parent.getParent();
}
}
}
} else if (isTaxonomyAdmin) {
hasRead |= hasReadAccess(type, null);
hasWrite |= hasWriteAccess(type, null);
}
}
node.setCanRead(hasRead);
node.setCanWrite(hasWrite);
} else if (node.getType() == TaxonomyTreeNodeType.templates) {
hasRead = true;
hasWrite = isTaxonomyAdmin;
node.setCanRead(hasRead);
node.setCanWrite(hasWrite);
}
for (int i = node.getChildCount(); i-- > 0; ) {
TaxonomyTreeNode child = (TaxonomyTreeNode) node.getChildAt(i);
child.setCanRead(hasRead);
child.setCanWrite(hasWrite);
computePermissionsRecursive(child, levelToCompetences);
}
}
use of org.olat.modules.taxonomy.TaxonomyCompetenceTypes 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);
}
use of org.olat.modules.taxonomy.TaxonomyCompetenceTypes 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);
}
Aggregations