feat: added admin filtering and tracking added for all admin related functionality#13
feat: added admin filtering and tracking added for all admin related functionality#13thevoid12 wants to merge 4 commits intoPandaWhoCodes:masterfrom
Conversation
…nd qr_codes along will all the api changes, hardcoded cleark jwks url is moved to env
PandaWhoCodes
left a comment
There was a problem hiding this comment.
Appreciate all the help.
thanks @thevoid12
give me sometime to confirm everything on my local and see if eveything works.
the last release is already up and running on events.build2learn.in
|
https://github.com/PandaWhoCodes/MagPie?tab=readme-ov-file#-contributors added contributors here |
| """Delete a message template""" | ||
| query = "DELETE FROM message_templates WHERE id = ?" | ||
| await db.execute(query, [template_id]) | ||
| query = "DELETE FROM message_templates WHERE id = ? AND admin_user_id = ?" |
There was a problem hiding this comment.
i should be able to delete any template
not just the templates created by me
| SELECT id, template_name, template_text, admin_user_id, created_at, updated_at | ||
| FROM message_templates | ||
| WHERE id = ? | ||
| WHERE id = ? AND admin_user_id = ? |
There was a problem hiding this comment.
same here
i need to get all templates
not just the ones I created
my templates should be accessible to all community admins
| SELECT id, template_name, template_text, created_at, updated_at | ||
| SELECT id, template_name, template_text, admin_user_id, created_at, updated_at | ||
| FROM message_templates | ||
| WHERE admin_user_id = ? |
| "DELETE FROM event_fields WHERE id = ? AND event_id = ?", | ||
| [field_id, event_id] | ||
| "DELETE FROM event_fields WHERE id = ? AND event_id = ? AND admin_user_id = ?", | ||
| [field_id, event_id, auth.user_id] |
There was a problem hiding this comment.
remove this lockin that only I can delete my content.
Can you run through the changes again and fix this across the board
I do not want to be the only person able to edit delete anything
the dashboard can be used across the board of organizers - no hierarchy there
There was a problem hiding this comment.
@PandaWhoCodes so any admin can view,edit or delete anything wrt event? I will make these changes then
There was a problem hiding this comment.
yes sir
Any - its the same behaviour we see in luma and google forms. We dont have multiple communities. this is a single community instance.
There was a problem hiding this comment.
please resolve these comments
|
@PandaWhoCodes made the changes. Removed the filter so admin dashboard related activities like edits,fetch or delete can be done by any admin! |
| event = await db.fetch_one( | ||
| "SELECT * FROM events WHERE is_active = 1 ORDER BY created_at DESC LIMIT 1" | ||
| async def get_active_event() -> List[EventResponse]: | ||
| """Get all active events for a specific admin""" |
There was a problem hiding this comment.
check this code. this documentation is not correct. we dont want to get admin specific tasks
There was a problem hiding this comment.
sorry didnt notice that. pushed the fixed documentation
Issue resolved: No admin tracking #7
issue:
Add admin filtering and API enhancements
Description
This PR adds admin-level data filtering for events, event_fields, message_templates, and qr_codes, along with moving hardcoded Clerk JWKS URL to environment variable.
Changes:
Tests:
Note:
since admin_user_id is a not null field, please delete the existing dev detabase to avoid db migration.