Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested or multiple filter collections #1

Closed
Mandolaren opened this issue Feb 2, 2021 · 3 comments
Closed

Nested or multiple filter collections #1

Mandolaren opened this issue Feb 2, 2021 · 3 comments
Assignees

Comments

@Mandolaren
Copy link

Mandolaren commented Feb 2, 2021

Hi !
First of all thanks a lot for this script, it's a very nice one to work with :)

I have some issues with nested filter collections, the filter function doesn't seem to work (at least for me ?).

For example, if I have in my xml

         <Filters>
		<FilterCollection bool="AND" not="0">
		    <FilterOrgUnit bool="AND" not="1" name="a" userContext="0" directMember="0"/>
                    <FilterOrgUnit bool="AND" not="0" name="b" userContext="0" directMember="0"/>
 			 <FilterCollection bool="AND" not="0">
				<FilterGroup bool="AND" not="0" name="x" userContext="1" directMember="0"/>
				<FilterGroup bool="OR" not="0" name="y" userContext="1" directMember="0"/>
				<FilterGroup bool="OR" not="0" name="z" userContext="1" directMember="0"/>					
			</FilterCollection>
		</FilterCollection>
	</Filters>

Which looks like this in gpp editor
Sans titre

Even if the first collection conditions are not met, printer will be deployed if the second collection conditions are met.

If I change the rules to be like this :

                 <Filters>	
			<FilterCollection bool="AND" not="0">		
			    <FilterOrgUnit bool="AND" not="1" name="an" userContext="0" directMember="0"/>
			    <FilterOrgUnit bool="AND" not="0" name="b" userContext="0" directMember="0" />
			</FilterCollection>
			<FilterCollection bool="AND" not="0">
				<FilterGroup bool="AND" not="0" name="x" userContext="1" directMember="0"/>
				<FilterGroup bool="OR" not="0" name="y" userContext="1" directMember="0"/>
				<FilterGroup bool="OR" not="0" name="as" userContext="1" directMember="0"/>
			</FilterCollection>	
	    </Filters> 

Which looks like this in gpp editor
Sans titre1

Even if the second collection conditions are not met, printer will be deployed (because the first collection conditions are met).

Thanks !

@CoasterKaty
Copy link
Owner

That's odd, I tested it with quite a few different variations but obviously not two collections like that. Will have a look at it when I get chance.

@CoasterKaty CoasterKaty self-assigned this Feb 2, 2021
@CoasterKaty
Copy link
Owner

Line 85, return evaluateFilters $Filter
Should read:
$return = evaluateFilters $Filter

then it seems to work, at least it did when I tested it with your first XML, the second one in the screenshot the "user in group" bits are following an empty collection, rather than being inside the collection.

@Mandolaren
Copy link
Author

Mandolaren commented Feb 3, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants