Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

Event and Venue creation pages #1215

Closed

Description

@ojeytonwilliams

After #1212 goes in it will not be possible to create events or venues from their respective dashboards (dashboard/venues and dashboard/events).

It would be nice if we brought back that functionality, updated to reflect the new permissions system. Specifically:

  • As an instance owner, I can go to the events/venues dashboard, click on 'add new' and then be able to create an event/venue for any chapter
  • As a chapter admin, I can go to to the events/venues dashboard, click on 'add new' and then be able to create an event/venue for the chapters I am an admin of

Activity

  1. added
    UI/UX
    on Jul 13, 2022
  2. gikf commented on Aug 1, 2022

    @gikf
    Member

    I was exploring ways to do this, I'm having hard time with finding good way to return appropriate list of admined chapters from server. In other words - differentiating between instance owner that can have all chapters, and filtering only chapters admined as chapter admin.

    Ideal would be single query, that would return appropriate chapters. There's however problem with authorizing for it.

    • For instance owner some permission with @Authorize can be used, but this will not work for chapter admin.
    • Not using @Authorize decorator would require some additional logic in the resolver, to figure out if user has instance owner permissions or not.

    Some alternatives:

    • Running two different queries? One for instance owner returning all chapters, and if that fails - user is not authorized, run another to return only admined chapters?
    • Client side filtering?

    All this feels convoluted and more complicated than it should be.

  3. ojeytonwilliams commented on Aug 2, 2022

    @ojeytonwilliams
    ContributorAuthor

    Thanks for the detailed breakdown, it really helped.

    I've got a couple of ideas for how to attack this. (Two is probably the most sensible, but it's up for debate)

    One

    1. give both instance owners and chapter admins the ListChapters instance permission.
    2. have the server send, respectively, all the chapters or all the chapters that that user administrates

    My logic was just this: both instance users and chapter admins need to know which chapters they control. Any permission has to be a instance permission, because, without making a query how do they know which chapterIds to send? If they don't know those ids (and have chapter level permissions) they'll be rejected by Auth.

    Two

    1. return the chapterIds in response to the useMeQuery

    It doesn't seem like a user should need special permission to see information about themselves (since that's all this really is - we're not talking about letting you see info about other users). So how about sending it as part of the user data that every user needs?

  4. gikf commented on Aug 4, 2022

    @gikf
    Member

    I like both of these. I agree it might not be really needed to additionally authorize listing of the admined chapters, after all, user not admining any chapter would simply receive empty list.

    This still leaves the need to include some permission logic in query listing admined chapters. With pseudocode:

    query list admined chapters {
      if (is instance owner aka can admin all chapaters) {
        return all chapters
      } else {
        return only chapters explicitly admined
      }
    }
    

    So I guess my question is, if it's okay to mix that here, and if there's any sort of preference in how to do that?

  5. ojeytonwilliams commented on Aug 4, 2022

    @ojeytonwilliams
    ContributorAuthor

    Okay, so let's say we with go with approach two. Then, yeah, it's still necessary to do some logic inside the me resolver (i.e. your pseudocode). I think that's a fine solution.

    I see what you mean about mixing permission logic into the resolver, but I think it's okay. The authChecker is still doing its one job (restricting access to resolvers) and the resolver is still doing its job (responding to queries that reach it). The fact that it has to respond differently based on req.user is probably okay - certainly for what you're working on.

    If we find ourselves wanting to make queries like "get me all the venues of all the chapters I'm an admin of" we might need something cleverer, but let's wait and see if that comes up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    UI/UX

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions