Project

General

Profile

« Previous | Next » 

Revision fe9e440d

Added by Katja Luther over 4 years ago

ref #8810: check for taxonnode permission and whether the user has taxon node granted authorities

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
9 9

  
10 10
package eu.etaxonomy.taxeditor.view.e4.details;
11 11

  
12
import java.util.Collection;
12 13
import java.util.EnumSet;
13 14
import java.util.HashSet;
14 15
import java.util.Set;
......
22 23
import org.eclipse.jface.viewers.SelectionChangedEvent;
23 24
import org.eclipse.jface.viewers.TreeNode;
24 25
import org.eclipse.swt.SWT;
26
import org.springframework.security.core.GrantedAuthority;
25 27

  
26 28
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
27 29
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
......
455 457
        if (hasPermission){
456 458
            for (TaxonNode node: nodes){
457 459
                hasPermission &= CdmStore.currentAuthentiationHasPermission(node, requiredCrud);
460
                if (!hasPermission){
461
                    //check whether there are explicit TaxonNode rights
462
                    boolean taxonnodePermissionExists = false;
463
                    Collection<? extends GrantedAuthority> authorities = CdmStore.getCurrentAuthentiation().getAuthorities();
464
                    for (GrantedAuthority grantedAuthority: authorities){
465
                        if (grantedAuthority.getAuthority().startsWith("TAXONNODE")){
466
                            taxonnodePermissionExists = true;
467
                        }
468
                    }
469
                    if (!taxonnodePermissionExists){
470
                        hasPermission = true;
471
                    }
472
                }
458 473
            }
459 474
        }
460 475
        detailsEnabled = hasPermission;

Also available in: Unified diff