Content selector not working as expected

20 views
Skip to first unread message

Mariska

unread,
Oct 21, 2023, 6:37:21 AM10/21/23
to Nexus Users
Hi all,

When I setup a content-selector and privilege for a raw hosted repository to be used
for browsing/reading it doesn't work as expected.

content-selector: cc-sel
format == "raw" and (path =^ "/aa/bb/cc")

privilege: cc-priv
content-selector: cc-sel
reposity: my-raw-hosted
actions: read,browse

When a user logs in with the privilege cc-priv, the user doesn't see any artifacts in my-raw-hosted, although there are artifacts below my-raw-hosted/aa/bb/cc.
When I change the content selector to: format == "raw" and (path =^ "/aa") all
the artifacts below /aa are shown.

The first content selector works for privileges with edit/add/delete, but not for browse/read.

Nexus version: 3.60.0-02

Could this be a bug?

Kind regards,
Mariska.

Rich Seddon

unread,
Oct 23, 2023, 4:00:28 PM10/23/23
to Nexus Users, Mariska
For browse to work you need to grant access to the directories above that location.  So you'd need to use a regular expression, and  "path =~"/|/aa/|/aa/bb/|/aa/bb/cc".  That grants access to see directory listings in the places above the file location.  Or you could just grant the nx-repository-browse-*-* privilege to allow seeing everything, and use content selectors with "read" action to restrict downloads.

Mariska

unread,
Oct 30, 2023, 5:31:35 AM10/30/23
to Nexus Users, Rich Seddon, Mariska
Thanks, Rich.

Mariska

unread,
Oct 30, 2023, 5:59:05 AM10/30/23
to Nexus Users, Mariska, Rich Seddon
I've tried this regular expression "path =~"/|/aa/|/aa/bb/|/aa/bb/cc" but it doesn't return anything. I found out that you need to omit the leading slash in front of the folders. This works:
```
format == "raw" and (path =~ "/|aa/|aa/bb/|aa/bb/cc/" or path =^ "/aa/bb/cc")
```
Reply all
Reply to author
Forward
0 new messages