Project

General

Profile

« Previous | Next » 

Revision 68b2628a

Added by Andreas Kohlbecker over 6 years ago

  • ID 68b2628aa8d5a04a8ce343e1298b0ca7f462e722
  • Parent 5613f613

ref #6999 fixing permission evaluation and adding debug button to gain per entitiy permissions

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItemEditButtonGroup.java
25 25
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
26 26
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
27 27
import eu.etaxonomy.cdm.vaadin.model.TypedEntityReference;
28
import eu.etaxonomy.cdm.vaadin.security.PermissionDebugUtils;
28 29
import eu.etaxonomy.cdm.vaadin.security.UserHelper;
29 30
import eu.etaxonomy.cdm.vaadin.util.converter.TypeDesignationSetManager.TypeDesignationWorkingSet;
30 31
import eu.etaxonomy.cdm.vaadin.util.converter.TypeDesignationSetManager.TypeDesignationWorkingSetType;
......
74 75
            nameIdButton = new IdButton<TaxonName>(TaxonName.class, regDto.getName().getId(), nameButton);
75 76
            Label nameLabel = new Label(regDto.getName().getLabel());
76 77
            nameLabel.setWidthUndefined();
77
            nameButton.setEnabled(!isRegistrationLocked && UserHelper.fromSession().userHasPermission(TaxonName.class, regDto.getName().getId(), CRUD.UPDATE));
78
            boolean userHasPermission = UserHelper.fromSession().userHasPermission(regDto.registration().getName(), CRUD.UPDATE);
79
            nameButton.setEnabled(!isRegistrationLocked && userHasPermission);
78 80

  
79 81
            addComponent(nameIdButton.getButton());
80
            // PermissionDebugUtils.fromSession().addGainPerEntityPermissionButton(this, TaxonName.class, regDto.getName().getId(), CRUD.UPDATE);
82
            PermissionDebugUtils.fromSession().addGainPerEntityPermissionButton(this, TaxonName.class, regDto.getName().getId(), EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
81 83
            addComponent(nameLabel);
82 84
        } else {
83 85
            // no name in the registration! we only show the typified name as label

Also available in: Unified diff