1
|
/**
|
2
|
* Copyright (C) 2017 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.vaadin.permission;
|
10
|
|
11
|
import java.util.Collection;
|
12
|
|
13
|
import org.springframework.security.core.GrantedAuthority;
|
14
|
|
15
|
/**
|
16
|
* @author a.kohlbecker
|
17
|
* @since Apr 25, 2017
|
18
|
*
|
19
|
*/
|
20
|
public interface AccessRestrictedView extends ReleasableResourcesView {
|
21
|
|
22
|
/**
|
23
|
* @return
|
24
|
*/
|
25
|
public boolean allowAnonymousAccess();
|
26
|
|
27
|
/**
|
28
|
* The collections of {@link GrantedAuthority} objects returned by this method are
|
29
|
* evaluated by the {@link AnnotationBasedAccessControlBean} to determine if the
|
30
|
* current authentication is having sufficient grants to access the view.
|
31
|
* <p>
|
32
|
* The collections are alternative sets of GrantedAuthorities to check.
|
33
|
* The GrantedAuthorities of each of the inner collections must instead all be satisfied.
|
34
|
*
|
35
|
* @return
|
36
|
*/
|
37
|
public Collection<Collection<GrantedAuthority>> allowedGrantedAuthorities();
|
38
|
|
39
|
public String getAccessDeniedMessage();
|
40
|
|
41
|
/**
|
42
|
* The <code>accessDeniedMessage</code> can be set my the presenter, e.g. in response
|
43
|
* to an Exception or during the processing of the bean to be loaded into the view.
|
44
|
* <p>
|
45
|
* In case an <code>accessDeniedMessage</code> is present access to the view is considered
|
46
|
* to be denied.
|
47
|
*
|
48
|
* @param accessDeniedMessage
|
49
|
*/
|
50
|
public void setAccessDeniedMessage(String accessDeniedMessage);
|
51
|
|
52
|
/**
|
53
|
* Evaluated by the {@link AccessRestrictedViewControlBean}
|
54
|
*
|
55
|
* @return true if the {@link #getAccessDeniedMessage()} is not <code>null</code>.
|
56
|
*/
|
57
|
default public boolean isAccessDenied(){
|
58
|
return getAccessDeniedMessage() != null;
|
59
|
}
|
60
|
|
61
|
}
|