dangsn
2024-06-06 33321f5486fd586fda6fd3f46b7e71754fede28b
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package com.vci.starter.web.annotation.permission;
 
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
 
/**
 * 权限控制的注解
 * 用于自动控制功能权限,按钮权限,和数据权限--数据权限会通过AOP的方式将数据权限的规则注入到QueryMap中
 * @author weidy
 *
 */
@Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface VciPermission {
    /**
     * 所属功能模块key--与功能菜单中的编号对应
     * @return
     */
    String[] modelKey() default "";
    
    /**
     * 所属按钮key--会自动注入到平台的操作类型中
     * @return
     */
    String[] methodKey() default "";
 
    /**
     * 所属按钮的名称
     * @return
     */
    String[] methodName() default "";
 
    /**
     * 所属按钮的名称
     * @return
     */
    String[] methodAlias() default "";
 
    /**
     * 所属按钮的描述
     * @return
     */
    String[] methodDesc() default "";
 
    /**
     * 所属按钮在菜单中的排序
     * @return
     */
    int[] methodOrder() default 0;
    
    /**
     * 固定的角色--角色的编码,多个使用逗号分隔
     * 支持表达式${lt}角色的类型值,表示访问的用户的角色类型必须小于某种类型,${eq}表示相等,${more}表示大于
     * *可以用于做通配符
     * @return
     */
    String defineRole() default "";
    
    /**
     * 允许的密级等级
     * @return
     */
    int secretGrade() default -1;
    
    /**
     * 允许ip密级
     * @return
     */
    String ipSecret() default "";
    
    /**
     * 方法的权限控制,如果为空时取defineRole的值
     * 固定的角色--角色的编码,多个使用逗号分隔
     * 支持表达式${lt}角色的类型值,表示访问的用户的角色类型必须小于某种类型,${eq}表示相等,${more}表示大于
     * *可以用于做通配符
     * @return
     */
    String defineRoleForMethod() default "";
    
    /**
     * 方法的权限密级控制,如果为空时取secretGrade的值
     * @return
     */
    int secretGradeForMethod() default -2;
    
    /**
     * 方法的权限IP控制,如果为空时取ipSecret的值
     * @return
     */
    String ipSecretForMethod() default "";
 
    /**
     * 数据权限判断所需的业务类型
     * @return
     */
    String dataPermissionBtmType() default "";
 
    /**
     * 数据权限判断所需的方法key。默认等于methodKey,所以不用设置
     * @return
     */
    String[] dataPermissionMethodKey() default "";
 
    /**
     * 是否控制数据权限,如果在config.properties里配置了right.switch后,默认值会处理为配置的值
     * @return
     */
    boolean controlDataPermission() default false;
    
    /**
     * 是否控制功能权限,如果在config.properties里配置了function.switch后,默认值会处理为配置的值
     * @return
     */
    boolean controlModelPermission() default true;
    
    /**
     * 是否控制按钮权限,如果在config.properties里配置了ui.right.switch后,默认值会处理为配置的值
     * @return
     */
    boolean controlMethodPermission() default true;
    
    /**
     * 用户密级
     * none--非密
     * inner--内部
     * secret--秘密
     * privacy--机密
     * @author weidy
     *
     */
    public static enum UserSecretGrade{
        none,inner,secret,privacy
    }
    
    
}