activist-org / activist

An open-source activism platform
https://activist.org
GNU Affero General Public License v3.0
209 stars 173 forks source link

feat/protect frontend routes #896

Closed UnknownSean8 closed 3 weeks ago

UnknownSean8 commented 1 month ago

Contributor checklist


Description

I just implemented the middleware in the events create route as I think most of the others are done. I also added a check in the admin guard as there's already a userIsAdmin variable in the store.

A few questions,

  1. Is it better if we make the guard a global middleware instead of the current implementation where we put the metadata into each file that we want to protect? If we change it into a global middleware I think we can just put in the route name in the middleware file instead.
  2. I don't understand the part where the signed-in user accesses the URL directly. Does this mean that the user is authenticated but is not an admin, so he will be redirected to the /home page or anyone who accesses the auth pages directly through the URL?

I might have missed it if it was discussed in the dev sync, sorry in advance and thanks!

Related issue

github-actions[bot] commented 1 month ago

Thank you for the pull request!

The activist team will do our best to address your contribution as soon as we can. The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and Development rooms once you're in. Also consider joining our bi-weekly Saturday dev syncs. It'd be great to have you!

Maintainer checklist

netlify[bot] commented 1 month ago

Deploy Preview for activist-org ready!

Name Link
Latest commit b28c9c02d20e124f59399adc4df43f6f51d9e48d
Latest deploy log https://app.netlify.com/sites/activist-org/deploys/6665e7d32fa30e000885d41b
Deploy Preview https://deploy-preview-896--activist-org.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.