Project

General

Profile

Revision 472cb9dc

ID472cb9dce75a42eadaf2ebfe04622223fa552b13
Parent 15035cf0
Child 991541d2

Added by Andreas Kohlbecker over 4 years ago

fix #6654 RegistrationVoter implemented

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/hibernate/permission/voter/RegistrationVoter.java
1
/**
2
* Copyright (C) 2014 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.persistence.hibernate.permission.voter;
10

  
11
import eu.etaxonomy.cdm.model.common.CdmBase;
12
import eu.etaxonomy.cdm.model.name.Registration;
13

  
14
/**
15
 * @author a.kohlbecker
16
 * @date Feb 24, 2014
17
 *
18
 */
19
public class RegistrationVoter extends CdmPermissionVoter {
20

  
21
    /* (non-Javadoc)
22
     * @see eu.etaxonomy.cdm.persistence.hibernate.permission.voter.CdmPermissionVoter#getResponsibilityClass()
23
     */
24
    @Override
25
    public Class<? extends CdmBase> getResponsibilityClass() {
26
        return Registration.class;
27
    }
28

  
29
    /* (non-Javadoc)
30
     * @see eu.etaxonomy.cdm.persistence.hibernate.permission.voter.CdmPermissionVoter#isOrpahn(eu.etaxonomy.cdm.model.common.CdmBase)
31
     */
32
    @Override
33
    public boolean isOrpahn(CdmBase object) {
34
        return ((Registration)object).getTypeDesignations().size() > 0 && ((Registration)object).getName() == null;
35
    }
36

  
37
}
cdmlib-persistence/src/main/resources/eu/etaxonomy/cdm/security_base.xml
46 46
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonNameVoter" />
47 47
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.ReferenceVoter" />
48 48
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TeamOrPersonBaseVoter" />
49
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.RegistrationVoter" />
49 50
            </list>
50 51
        </constructor-arg>
51 52
    </bean>

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)