Revision cd5fdc98
Added by Andreas Müller almost 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java | ||
---|---|---|
459 | 459 |
requiredCrud = EnumSet.of(CRUD.UPDATE); |
460 | 460 |
} |
461 | 461 |
boolean hasPermission = CdmStore.currentAuthentiationHasPermission(StoreUtil.getCdmEntity(getInput()), requiredCrud); |
462 |
TaxonBase taxonBase = (TaxonBase)getInput(); |
|
463 |
Taxon acceptedTaxon = null; |
|
464 |
if (taxonBase instanceof Taxon){ |
|
465 |
acceptedTaxon = (Taxon)taxonBase; |
|
466 |
}else{ |
|
467 |
acceptedTaxon = ((Synonym)taxonBase).getAcceptedTaxon(); |
|
468 |
} |
|
469 |
Set<TaxonNode> nodes = acceptedTaxon.getTaxonNodes(); |
|
470 |
// check for subtree permissions as well. |
|
471 | 462 |
if (hasPermission){ |
472 |
for (TaxonNode node: nodes){ |
|
473 |
hasPermission &= CdmStore.currentAuthentiationHasPermission(node, requiredCrud); |
|
474 |
if (!hasPermission){ |
|
475 |
//check whether there are explicit TaxonNode rights |
|
476 |
boolean taxonnodePermissionExists = false; |
|
477 |
Collection<? extends GrantedAuthority> authorities = CdmStore.getCurrentAuthentiation().getAuthorities(); |
|
478 |
for (GrantedAuthority grantedAuthority: authorities){ |
|
479 |
if (grantedAuthority.getAuthority().startsWith("TAXONNODE")){ |
|
480 |
taxonnodePermissionExists = true; |
|
463 |
// check for subtree permissions as well. |
|
464 |
TaxonBase<?> taxonBase = (TaxonBase<?>)getInput(); |
|
465 |
Taxon acceptedTaxon = null; |
|
466 |
if (taxonBase instanceof Taxon){ |
|
467 |
acceptedTaxon = (Taxon)taxonBase; |
|
468 |
}else{ |
|
469 |
acceptedTaxon = ((Synonym)taxonBase).getAcceptedTaxon(); |
|
470 |
} |
|
471 |
if (acceptedTaxon != null){ //needs discussion if synonyms without accepted taxon should never be filtered by subtree permission(current implementation). See also #8849 |
|
472 |
Set<TaxonNode> nodes = acceptedTaxon.getTaxonNodes(); |
|
473 |
for (TaxonNode node: nodes){ |
|
474 |
hasPermission &= CdmStore.currentAuthentiationHasPermission(node, requiredCrud); |
|
475 |
if (!hasPermission){ |
|
476 |
//check whether there are explicit TaxonNode rights |
|
477 |
boolean taxonnodePermissionExists = false; |
|
478 |
Collection<? extends GrantedAuthority> authorities = CdmStore.getCurrentAuthentiation().getAuthorities(); |
|
479 |
for (GrantedAuthority grantedAuthority: authorities){ |
|
480 |
if (grantedAuthority.getAuthority().startsWith("TAXONNODE")){ |
|
481 |
taxonnodePermissionExists = true; |
|
482 |
} |
|
483 |
} |
|
484 |
if (!taxonnodePermissionExists){ |
|
485 |
hasPermission = true; |
|
481 | 486 |
} |
482 |
} |
|
483 |
if (!taxonnodePermissionExists){ |
|
484 |
hasPermission = true; |
|
485 | 487 |
} |
486 | 488 |
} |
487 | 489 |
} |
Also available in: Unified diff
fix #8849 fix NPE for synonyms without accepted taxon in details view and some code cleaning