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

Regex not working. #1034

Closed
SJ50 opened this issue Jul 16, 2020 · 5 comments
Closed

Regex not working. #1034

SJ50 opened this issue Jul 16, 2020 · 5 comments

Comments

@SJ50
Copy link

SJ50 commented Jul 16, 2020

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

@o1egl
Copy link
Member

o1egl commented Jul 16, 2020

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

@o1egl o1egl closed this as completed Aug 2, 2020
@thomaschampagne
Copy link

thomaschampagne commented Aug 2, 2020

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

@SJ50
Copy link
Author

SJ50 commented Aug 3, 2020

@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.

@thomaschampagne
Copy link

@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.

@o1egl
Copy link
Member

o1egl commented Aug 5, 2020

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

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

3 participants