ludc
2024-08-15 118211ba511524e94952c896bd508ff9baec46c8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package com.vci.web.service;
 
import com.vci.pagemodel.SmUserVO;
import com.vci.starter.web.exception.VciBaseException;
 
/**
 * web端的密级服务
 */
public interface WebSecretServiceI {
 
 
    /**
     * 获取用户密级的最小值
     * @return 密级的值
     * @throws VciBaseException 查询出错会抛出异常
     */
    int getMinUserSecret() throws VciBaseException;
 
    /**
     * 获取数据密级的默认值
     * @return 密级的值
     * @throws VciBaseException 查询出错会抛出异常
     */
    int getMinDataSecret() throws VciBaseException;
 
    /**
     * 获取IP密级的默认值
     * @return 密级的值
     * @throws VciBaseException 查询出错会抛出异常
     */
    int getMinIpSecret() throws VciBaseException;
 
    /**
     * 获取用户密级
     * @param userId 用户主键
     * @return 用户的密级
     * @throws VciBaseException 参数错误,用户不存在会抛出异常
     */
    int getUserSecret(String userId) throws VciBaseException ;
 
    /**
     * 获取用户密级
     * @param userVO 用户的显示对象
     * @return 用户的密级
     * @throws VciBaseException 参数错误,用户不存在会抛出异常
     */
    int getUserSecret(SmUserVO userVO) throws VciBaseException;
 
    /**
     * 校验当前用户是否有权限访问数据
     * @param secret 数据的密级
     * @return true表示允许访问
     */
    boolean checkDataSecret(int secret);
 
    /**
     * 校验用户的密级是否是否有权限访问数据
     * @param secret 数据的密级
     * @param userSecret 用户密级
     * @return true表示允许访问
     */
    boolean checkDataSecret(int secret, int userSecret) ;
 
    /**
     * 根据用户名来校验数据密级
     * @param secret 数据的密级
     * @param userId 用户名
     * @return true表示允许访问
     * @throws VciBaseException 参数错误,用户不存在会抛出异常
     */
    boolean checkDataSecret(int secret, String userId) throws VciBaseException;
 
    /**
     * 根据用户对象来校验数据密级
     * @param secret  数据的密级
     * @param userVO 用户的显示对象
     * @return true表示允许访问
     */
    boolean checkDataSecret(int secret, SmUserVO userVO) ;
 
    /**
     * 获取IP地址的密级
     * @param ip ip地址
     * @return 密级的值
     * @throws VciBaseException 查询出错的时候会抛出异常
     */
    int getIpSecret(String ip) throws VciBaseException;
    /**
     * 检查机器密级
     * @param ipSecret 机器密级
     * @param userSecret 用户的密级
     * @return 密级的值
     */
    boolean checkIpSecret(int ipSecret, int userSecret);
 
    /**
     * 检查当前用户是否符合机器密级
     * @param ipSecret 机器密级
     * @return true表示允许访问
     */
    boolean checkIpSecret(int ipSecret) ;
 
    /**
     * 校验指定ip和用户是否符合机器密级
     * @param ip ip地址
     * @param userId 用户名
     * @return true表示允许访问
     * @throws VciBaseException 参数错误,用户不存在会抛出异常
     */
    boolean checkIpSecret(String ip, String userId) throws VciBaseException;
 
    /**
     * 校验指定IP和用户对象符合机器密级
     * @param ip ip地址
     * @param userVO 用户对象
     * @return  true表示允许访问
     */
    boolean checkIpSecret(String ip, SmUserVO userVO) ;
 
}