File tree 2 files changed +6
-4
lines changed
main/java/org/casbin/jcasbin/util
test/java/org/casbin/jcasbin/main
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -117,12 +117,13 @@ public static String convertInSyntax(String expString) {
117
117
String reg = "([a-zA-Z0-9_.()\" ]*) +in +([a-zA-Z0-9_.()\" ]*)" ;
118
118
Matcher m1 = Pattern .compile (reg ).matcher (expString );
119
119
StringBuffer sb = new StringBuffer ();
120
- boolean flag = false ;
120
+ boolean flag = false ;
121
121
while (m1 .find ()) {
122
- flag = true ;
123
- m1 .appendReplacement (sb ,"include($2, $1)" );
122
+ flag = true ;
123
+ m1 .appendReplacement (sb , "include($2, $1)" );
124
124
}
125
- return flag ?sb .toString ():expString ;
125
+ m1 .appendTail (sb );
126
+ return flag ? sb .toString () : expString ;
126
127
}
127
128
/**
128
129
* removeComments removes the comments starting with # in the text.
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ public void testConvertInSyntax(){
45
45
assertEquals ("include(r_obj, r_sub)" , Util .convertInSyntax ("r_sub in r_obj" ));
46
46
assertEquals ("include(r_obj, r_sub.name)" , Util .convertInSyntax ("r_sub.name in r_obj" ));
47
47
assertEquals ("include(r_obj.name, r_sub.name)" , Util .convertInSyntax ("r_sub.name in r_obj.name" ));
48
+ assertEquals ("include(r_obj, r_sub) && r.obj == p.obj" , Util .convertInSyntax ("r_sub in r_obj && r.obj == p.obj" ));
48
49
}
49
50
50
51
@ Test
You can’t perform that action at this time.
0 commit comments