Get list of events where a specific user is chairperson

Is there a way, using API, to get a list of all events where a specific user is a chairperson (or has manage permission)?

No, but you can use indico shell for this:

u = User.get(ID)
managed_events = [p.event for p in u.in_event_acls.filter(EventPrincipal.full_access).all()]
chaired_events = [p.event for p in u.event_persons.filter(EventPerson.event_links.any()).all()]
1 Like

Thank you very much, @ThiefMaster

@ThiefMaster
I tested this:

and it is exactly what I needed. Can you provide any advice on how to make use of it to pass the results to an external app?

Depends on the format in which you need it…

1 Like

Any format will work

I mean what are you looking for… event ids, event titles, event urls?

1 Like

Yes, just the basic info of the events.

If I get the events ID’s I can get other details using the HTTP API

'-'.join(str(e.id) for e in managed_events) gives you a dash-separated list of the event IDs which you can use directly in the HTTP API. But you can get most of the data from the event objects in the shell as well…

I meant how can I make the code that is run in shell to be accessible from an external app? I want an external app to send the ID of the user and get the ID’s of events. The above code runs in shell, can I make it available to the public in any way?

Uh no. You would need to create a plugin for this that exposes an API for it. I thought you just wanted to get it one-off and then use it somehow…

1 Like

Thank you very much for your time