Project

General

Profile

Download (1.35 KB) Statistics
| Branch: | Tag: | Revision:
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.security;
10

    
11
import com.vaadin.server.VaadinSession;
12

    
13
import eu.etaxonomy.cdm.model.common.CdmBase;
14

    
15
/**
16
 * UserHelper interface. Imeplemtations should use the {@link #VADDIN_SESSION_KEY} to auto registers
17
 * in the VaadinSession.
18
 *
19
 * @author a.kohlbecker
20
 * @since May 23, 2017
21
 *
22
 */
23
public interface UserHelper {
24

    
25
    public static final String VADDIN_SESSION_KEY = "USER_HELPER";
26

    
27
    /**
28
     * Static accessor method to obtain the auto-registered UserHelper-Bean from the
29
     * VaadinSession.
30
     *
31
     * @return
32
     */
33
    public static UserHelper fromSession() {
34
       return (UserHelper)VaadinSession.getCurrent().getAttribute(VADDIN_SESSION_KEY);
35
    }
36

    
37
    boolean userHasPermission(Class<? extends CdmBase> cdmType, Integer entitiyId, Object ... args);
38

    
39
    boolean userHasPermission(Class<? extends CdmBase> cdmType, Object ... args);
40

    
41
    boolean userHasPermission(CdmBase entity, Object ... args);
42

    
43
    boolean userIsRegistrationCurator();
44

    
45
    boolean userIsAdmin();
46

    
47
    String userName();
48

    
49
    boolean userIsAnnonymous();
50

    
51
    boolean userIsAutheticated();
52

    
53

    
54
}
(5-5/6)