use of com.artipie.repo.RepoPerms in project artipie by artipie.
the class YamlPermissionsTest method checksGroups.
@ParameterizedTest
@CsvSource(value = { "mark,read,readers,true", "olga,write,group-a;group-b,true", "john,read,abc;def,false", "jane,manage,readers;leaders,false", "ann,read,'',false" }, nullValues = "''")
void checksGroups(final String name, final String action, final String groups, final boolean res) {
final YamlMapping settings = new RepoPerms(new ListOf<>(new RepoPermissions.PermissionItem(name, "write"), new RepoPermissions.PermissionItem("/readers", "read"))).permsYaml();
MatcherAssert.assertThat(new YamlPermissions(settings).allowed(new Authentication.User(name, new ListOf<String>(groups.split(";"))), action), new IsEqual<>(res));
}
Aggregations