use of org.ovirt.engine.api.extensions.ExtKey in project ovirt-engine by oVirt.
the class InternalAuthz method doQueryOpenImpl.
private boolean doQueryOpenImpl(ExtMap filter) {
boolean found = false;
if (filter.<Integer>get(Authz.QueryFilterRecord.OPERATOR) == Authz.QueryFilterOperator.EQ) {
ExtKey extKey = filter.get(Authz.QueryFilterRecord.KEY);
if (extKey.equals(Authz.PrincipalRecord.NAME)) {
String name = filter.get(Authz.PrincipalRecord.NAME);
found = adminUser.<String>get(Authz.PrincipalRecord.NAME).matches(name.replace("*", ".*"));
} else if (extKey.equals(Authz.PrincipalRecord.ID)) {
found = filter.<String>get(Authz.PrincipalRecord.ID).equals(adminUser.<String>get(Authz.PrincipalRecord.ID));
} else {
found = false;
}
} else {
for (ExtMap currentFilter : filter.<Collection<ExtMap>>get(Authz.QueryFilterRecord.FILTER)) {
found = found || doQueryOpenImpl(currentFilter);
}
}
return found;
}
use of org.ovirt.engine.api.extensions.ExtKey in project ovirt-engine by oVirt.
the class SearchParsingUtils method generateQueryMap.
public static ExtMap generateQueryMap(Collection<String> ids, ExtUUID queryEntity) {
ExtMap result = new ExtMap().mput(Authz.InvokeKeys.QUERY_ENTITY, queryEntity);
ExtKey key = queryEntity.equals(Authz.QueryEntity.GROUP) ? Authz.GroupRecord.ID : Authz.PrincipalRecord.ID;
List<ExtMap> filter = ids.stream().map((id) -> createMapForKeyAndValue(key, id)).collect(Collectors.toList());
result.mput(QueryFilterRecord.OPERATOR, QueryFilterOperator.OR).mput(QueryFilterRecord.FILTER, filter);
return result;
}
Aggregations