Project

General

Profile

« Previous | Next » 

Revision a6f051fd

Added by Andreas Kohlbecker almost 7 years ago

ref #6169 protectecting also AuthorTeam fields

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/common/TeamOrPersonField.java
19 19
import eu.etaxonomy.cdm.model.agent.Person;
20 20
import eu.etaxonomy.cdm.model.agent.Team;
21 21
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
22
import eu.etaxonomy.cdm.vaadin.security.UserHelper;
22 23
import eu.etaxonomy.vaadin.component.CompositeCustomField;
23 24
import eu.etaxonomy.vaadin.component.FieldListEditor;
24 25
import eu.etaxonomy.vaadin.component.SwitchableTextField;
......
121 122
        } else {
122 123
            setComponentError(new UserError("TeamOrPersonField Error: Unsupported value type: " + newValue.getClass().getName()));
123 124
        }
125

  
126
        checkUserPermissions(newValue);
127
    }
128

  
129
    private void checkUserPermissions(TeamOrPersonBase<?> newValue) {
130
        boolean userCanEdit = UserHelper.fromSession().userHasPermission(newValue, "DELETE", "UPDATE");
131
        titleField.setEnabled(userCanEdit);
132
        nomenclaturalTitleField.setEnabled(userCanEdit);
124 133
    }
125 134

  
126 135
    /**

Also available in: Unified diff