File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
api/src/main/java/io/kafbat/ui/model/rbac Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 11package io .kafbat .ui .model .rbac ;
22
3- import com .google .common .base .Preconditions ;
3+ import static com .google .common .base .Preconditions .checkArgument ;
4+
45import java .util .List ;
56import lombok .Data ;
67
@@ -13,9 +14,11 @@ public class Role {
1314 List <Permission > permissions ;
1415
1516 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" );
1719 permissions .forEach (Permission ::transform );
1820 permissions .forEach (Permission ::validate );
21+ subjects .forEach (Subject ::validate );
1922 }
2023
2124}
Original file line number Diff line number Diff line change 11package io .kafbat .ui .model .rbac ;
22
3+ import static com .google .common .base .Preconditions .checkArgument ;
4+ import static com .google .common .base .Preconditions .checkNotNull ;
5+
36import io .kafbat .ui .model .rbac .provider .Provider ;
47import lombok .Getter ;
58
@@ -21,4 +24,12 @@ public void setType(String type) {
2124 public void setValue (String value ) {
2225 this .value = value ;
2326 }
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+ }
2435}
You can’t perform that action at this time.
0 commit comments