Skip to content

Support subgroup#5

Open
bapt wants to merge 1 commit into
jech:masterfrom
bapt:subgroup
Open

Support subgroup#5
bapt wants to merge 1 commit into
jech:masterfrom
bapt:subgroup

Conversation

@bapt

@bapt bapt commented Jan 2, 2025

Copy link
Copy Markdown

By matching the group name with globs, it allows users to define valid groups the following way:
groups: [ "groups/*" ]
to allow subgroup to work

@jech

jech commented Jan 2, 2025

Copy link
Copy Markdown
Owner

I agree with the need for this feature. Related feature: https://lists.galene.org/galene/87ikrvfzdm.wl-jch@irif.fr

I have two minor objections to your patch:

  • a group could be called *, so the syntax is ambiguous;
  • you're now walking the whole groups table, so the behaviour is O(n).

if AllowedSubGroups is defined, then walk down the request path
timiing each time after the last '/' up to the point where a valid group
is found.
@bapt

bapt commented Jan 2, 2025

Copy link
Copy Markdown
Author

new attempt, trying to address your comments

@jech

jech commented Jan 2, 2025

Copy link
Copy Markdown
Owner

I think it needs more thought.

Right now, it's an all-or-nothing option, it's not possible to set some groups to allow subgroups and not others. I'm sure it solves your immediate need, but I think we need a more general solution.

I'm a little worried about the lastIndex bit. What if the client passes a string like /groups/foo/bar, will you grant them access to /groups/foo/baz?

You still have O(n) behaviour in the allowSubgroups case. You need to do something like (I didn't check the details):

    for group != "" {
        if groups[group] {
            return true
        }
        group = path.Base(group)
    }

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

Successfully merging this pull request may close these issues.

2 participants