File tree 2 files changed +16
-2
lines changed
api/src/main/java/io/kafbat/ui/model/rbac
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
1
package io .kafbat .ui .model .rbac ;
2
2
3
- import com .google .common .base .Preconditions ;
3
+ import static com .google .common .base .Preconditions .checkArgument ;
4
+
4
5
import java .util .List ;
5
6
import lombok .Data ;
6
7
@@ -13,9 +14,11 @@ public class Role {
13
14
List <Permission > permissions ;
14
15
15
16
public void validate () {
16
- Preconditions .checkArgument (!clusters .isEmpty (), "Role clusters cannot be empty" );
17
+ checkArgument (!clusters .isEmpty (), "Role clusters cannot be empty" );
18
+ checkArgument (!subjects .isEmpty (), "Role subjects cannot be empty" );
17
19
permissions .forEach (Permission ::transform );
18
20
permissions .forEach (Permission ::validate );
21
+ subjects .forEach (Subject ::validate );
19
22
}
20
23
21
24
}
Original file line number Diff line number Diff line change 1
1
package io .kafbat .ui .model .rbac ;
2
2
3
+ import static com .google .common .base .Preconditions .checkArgument ;
4
+ import static com .google .common .base .Preconditions .checkNotNull ;
5
+
3
6
import io .kafbat .ui .model .rbac .provider .Provider ;
4
7
import lombok .Getter ;
5
8
@@ -21,4 +24,12 @@ public void setType(String type) {
21
24
public void setValue (String value ) {
22
25
this .value = value ;
23
26
}
27
+
28
+ public void validate () {
29
+ checkNotNull (type , "Subject type cannot be null" );
30
+ checkNotNull (value , "Subject value cannot be null" );
31
+
32
+ checkArgument (!type .isEmpty (), "Subject type cannot be empty" );
33
+ checkArgument (!value .isEmpty (), "Subject value cannot be empty" );
34
+ }
24
35
}
You can’t perform that action at this time.
0 commit comments