Project

General

Profile

« Previous | Next » 

Revision 2b3d2b38

Added by Andreas Kohlbecker almost 7 years ago

ref #6169 harmonizing the check if user is curator

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/security/UserHelper.java
61 61
        Authentication authentication = getAuthentication();
62 62
        if(authentication != null) {
63 63
            return authentication.getAuthorities().stream().anyMatch(a -> {
64
                // doing faster regex check here instreas of using CdmAuthoritiy.fromString()
65
                return a.getAuthority().matches("^Registration\\.\\[.*UPDATE");
64
                return a.equals(RolesAndPermissions.ROLE_CURATION)
65
                        // doing faster regex check here instreas of using CdmAuthoritiy.fromString()
66
                        || a.getAuthority().matches("^Registration\\.\\[.*UPDATE");
66 67
            });
67 68
        }
68 69
        return false;
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListPresenter.java
21 21
import eu.etaxonomy.cdm.model.common.User;
22 22
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
23 23
import eu.etaxonomy.cdm.model.reference.Reference;
24
import eu.etaxonomy.cdm.persistence.hibernate.permission.Role;
25 24
import eu.etaxonomy.cdm.service.IRegistrationWorkingSetService;
26 25
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
27 26
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent;
28
import eu.etaxonomy.cdm.vaadin.security.RolesAndPermissions;
27
import eu.etaxonomy.cdm.vaadin.security.UserHelper;
29 28
import eu.etaxonomy.vaadin.mvp.AbstractPresenter;
30 29

  
31 30
/**
......
64 63
        // list all if the authenticated user is having the role CURATION of if it is an admin
65 64
        Authentication authentication = currentSecurityContext().getAuthentication();
66 65
        User submitter = null;
67
        if(!authentication.getAuthorities().stream().anyMatch(ga -> ga.equals(RolesAndPermissions.ROLE_CURATION) || ga.equals(Role.ROLE_ADMIN))){
66
        if(!(UserHelper.userIsRegistrationCurator() || UserHelper.userIsAdmin())) {
68 67
            submitter = (User) authentication.getPrincipal();
69 68
        }
70 69

  

Also available in: Unified diff