Project

General

Profile

Revision 600e562c

ID600e562c50acd476aac3d4cb88e3d844cb8b9d0b
Parent 437f2e6f
Child 50257107

Added by Andreas Kohlbecker about 2 years ago

ref #6169 inserting Role Curation as required data

View differences:

src/main/java/eu/etaxonomy/cdm/dataInserter/RegistrationRequiredDataInserter.java
40 40
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
41 41
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
42 42
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
43
import eu.etaxonomy.cdm.persistence.hibernate.permission.Role;
43 44
import eu.etaxonomy.cdm.persistence.query.MatchMode;
45
import eu.etaxonomy.cdm.vaadin.security.RolesAndPermissions;
44 46

  
45 47
/**
46 48
 * @author a.kohlbecker
......
72 74
     */
73 75
    @Override
74 76
    public void onApplicationEvent(ContextRefreshedEvent event) {
77
        insertRequiredData();
75 78
        executeSuppliedCommands();
76 79
    }
77 80

  
78 81
    /**
82
 *
83
 */
84
private void insertRequiredData() {
85
    Role roleCuration = RolesAndPermissions.ROLE_CURATION;
86
    if(repo.getGrantedAuthorityService().find(roleCuration.getUuid()) == null){
87
        repo.getGrantedAuthorityService().saveOrUpdate(roleCuration.asNewGrantedAuthority());
88
        repo.getGrantedAuthorityService().getSession().flush();
89
    }
90

  
91
}
92

  
93
    /**
79 94
     *
80 95
     */
81 96

  
src/main/java/eu/etaxonomy/cdm/vaadin/security/RolesAndPermissions.java
10 10

  
11 11
import java.util.UUID;
12 12

  
13
import org.springframework.security.core.GrantedAuthority;
14

  
15 13
import eu.etaxonomy.cdm.persistence.hibernate.permission.Role;
16 14

  
17 15
/**
......
24 22
 */
25 23
public class RolesAndPermissions {
26 24

  
27
    public static final GrantedAuthority ROLE_CURATION = new Role(UUID.fromString("642d9ea7-f18c-4ac3-b437-ed05ce5461c3"), "ROLE_CURATION");
25
    public static final Role ROLE_CURATION = new Role(UUID.fromString("642d9ea7-f18c-4ac3-b437-ed05ce5461c3"), "ROLE_CURATION");
28 26

  
29 27

  
30 28
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)