1
|
/**
|
2
|
* Copyright (C) 2012 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 java.util.Collection;
|
12
|
|
13
|
import org.springframework.security.access.ConfigAttribute;
|
14
|
import org.springframework.security.access.vote.UnanimousBased;
|
15
|
import org.springframework.security.core.Authentication;
|
16
|
|
17
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
18
|
|
19
|
/**
|
20
|
* This voter always returns {@link #ACCESS_GRANTED}.
|
21
|
* It is needed as default voter when using the {@link UnanimousBased}
|
22
|
* @author andreas kohlbecker
|
23
|
* @date Sep 4, 2012
|
24
|
*
|
25
|
*/
|
26
|
public class GrantAlwaysVoter extends CdmPermissionVoter {
|
27
|
|
28
|
/* (non-Javadoc)
|
29
|
* @see org.springframework.security.access.AccessDecisionVoter#vote(org.springframework.security.core.Authentication, java.lang.Object, java.util.Collection)
|
30
|
*/
|
31
|
@Override
|
32
|
public int vote(Authentication authentication, CdmBase object, Collection<ConfigAttribute> attributes) {
|
33
|
return ACCESS_GRANTED;
|
34
|
}
|
35
|
|
36
|
@Override
|
37
|
public Class<? extends CdmBase> getResponsibilityClass() {
|
38
|
return CdmBase.class;
|
39
|
}
|
40
|
|
41
|
/* (non-Javadoc)
|
42
|
* @see eu.etaxonomy.cdm.persistence.hibernate.permission.voter.CdmPermissionVoter#isOrpahn(eu.etaxonomy.cdm.model.common.CdmBase)
|
43
|
*/
|
44
|
@Override
|
45
|
public boolean isOrpahn(CdmBase object) {
|
46
|
return false;
|
47
|
}
|
48
|
|
49
|
}
|