Apply a regular expression to hipposys:facetrule "value" due to dynamic folder names

I want to restrict a nested folder for certain user groups. The documentation says the value attribute needs to be an “absolute path” , though I thought it was possible to make this a regular expression.

Simple example, I want to restrict all legal folders from a user group, but if a new legal folder is added I dont want to configure and restrict this folder section specifically, would like this to be dynamic by a regex like content/document/hippoproject/content/.*/legal

/content/document/hippoproject/content/marketing/legal
/content/document/hippoproject/content/sales/legal
/content/document/hippoproject/content/developers/legal

Is it possible to put a regular expression in the value attribute of a hipposys:facetrule.

I’ve tried multiple expressions, but get the same error when logging in : [Domain.:113] Unable to add DomainRule ‘/hippo:configuration/hippo:domains/hippofolders/hippostd-folder’ : Failed to resolve path relative to node /

Documentation references:
https://www.onehippo.org/library/concepts/security/domains.html
https://www.onehippo.org/library/concepts/security/authorization-use-cases/deny-access-to-a-folder.html

1 Like

What you could do instead is make a new type that inherits from hippostd:folder and then restrict it on nodetype.

@jasper.floor I will give that a try. Thanks

I am also looking for solution for a similar problem. I am not sure about the solution here.
@mdg - I believe you ask is to restrict all documents under the folder “/content/document/hippoproject/content/.*/legal” irrespective of nested folder where “legal” folder lives right?

@jasper.floor - Can you please help us understand how we can achieve this with the restricting based on “nodetype”, if we want to block a folder name “legal” the nodetype would be “hippostd:folder” and would not be possible as all folder are of node type “hippostd:folder”. Can you please clarify if we have not understood your answer?

Create a new type,
myhippoproject:folder > hippostd:folder

Make legal folders of that type. Create a domain rule with a facet nodetype of myhippoproject:folder. Set up the rules so that only your legal group users can read it.

some reference documentation:
https://www.onehippo.org/library/concepts/content-repository/defining-node-types.html
https://www.onehippo.org/library/concepts/document-types/control-the-allowed-document-types-in-a-folder.html
https://www.onehippo.org/library/concepts/document-types/template-queries.html

@jasper.floor If we created the template for the first time and then created new folders with this template, this is working, let’s say if we have existing folder and nested folders , and then added template with restriction, looks like the restriction is not getting applicable to sub folders. Could you please suggest on this.

I’m not 100% clear on what you mean.

@jasper.floor for the last comment and articles provided by you
" https://www.onehippo.org/library/concepts/content-repository/defining-node-types.html


https://www.onehippo.org/library/concepts/document-types/template-queries.html "

if the template query is created at console, and then on hippo ui if we create a new folder, this is working as expected.

Lets say if we have already existing folders and sub folders and later created the template query, this template query nis not getting applicable , please find screenshot

For Main Folder I applied Query, so we are seeing “New Lewis Document” and “New Lewis Folder”

image

For Sub Folder “hellotest” which is created after the template queries are added to Main Folder, it has , “New Lewis Document” and “New Lewis Folder”
image

where as for existing folder “test” which is already present before the template query is created, it is not updated.

image

Please let me know if I am missing something here.

@Prats
These have to be manually updated, if they already existed. Same steps, edit the allowed content and choose the appropriate items.

The reason is that the “allowed content” is stored on each folder node, so these do not get updated when you change the parent folder “allowed content”. This is why you define in console, what the allowed content is on the “new Lewis Folder”.

If you updated this in a local environment, and then deployed (without content) you will also note that the template queries have been added to the “Edit allowed content” popup (these are considered config) but the folder will not have updated (these are considered content).