Filebrowser: Regex not working.

Created on 16 Jul 2020  路  5Comments  路  Source: filebrowser/filebrowser

I wanted to create separate user with limited number of folder access.

So I added regex ^(?:(?!Foo|Bar).)*$\r?\n? to allow folder named "Foo" and "Bar" but it does not work.
I get message "Something really went wrong."

I do not want to disallow all the folder individually.

image

Most helpful comment

@thomaschampagne use the following rules
image

first one is disallowing everything and following after that rules allows "Foo" and "Bar".

@o1egl Please add this to wiki, I found this solution in closed issue answer. This solution is very handy when you have 100s of folder but want to allow few folder to users.

All 5 comments

Your regexp is not valid https://play.golang.org/p/-QM2-bgDO3u

Hi! Same kind of issue for me. Trying to "disallow all paths expect 2 folders" for a user. For this we could use regex "negation" pattern (see this: https://stackoverflow.com/questions/1687620/regex-match-everything-but-specific-pattern)

But standard Golang regex seems not support it... Okay. (https://stackoverflow.com/questions/26771592/negative-look-ahead-go-regular-expressions)

Actually i tried the "negative way" because the "positive way" didn't worked as i could expect:

image

I expected to not see the homes folder :(

I think @SJ50 and me are trying to do the same thing: How to give access only to a list of folders?

Thanks,

Thomas

@thomaschampagne use the following rules
image

first one is disallowing everything and following after that rules allows "Foo" and "Bar".

@o1egl Please add this to wiki, I found this solution in closed issue answer. This solution is very handy when you have 100s of folder but want to allow few folder to users.

@SJ50 Thanks for the tip.

I needed to apply the similiar behavior with a inner folder.

The use case: I want alice to a have access to "downloads" folder and only his home folder /homes/alice. Access to folder /homes/bob must be denied for alice

Here's is the working config for this usual case:

image

These usuals use cases should be added to wiki too.

@thomaschampagne @SJ50 you are welcome to make a PR https://github.com/filebrowser/docs :wink:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  6Comments

zxysilent picture zxysilent  路  5Comments

bcardiff picture bcardiff  路  3Comments

karim2001 picture karim2001  路  5Comments

chanyk-joseph picture chanyk-joseph  路  4Comments