Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

feat: admin user check middleware #9249

Merged

Conversation

bikrantjajware
Copy link
Contributor

Fixes Issue

Closes #8389

Changes proposed

  • Added middleware to check admin usernames on route "/admin" and "/api/admin"
  • removed Admin username check from individual admin files

Check List (Check all the applicable boxes)

  • [X ] My code follows the code style of this project.
  • My change requires changes to the documentation.
  • I have updated the documentation accordingly.
  • [X ] All new and existing tests passed.
  • [ X] This PR does not contain plagiarized content.
  • [ X] The title of my pull request is a short description of the requested changes.

Screenshots

Note to reviewers

NOTE:

  • Using process.env in middleware file instead of serverEnv to avoid errors thrown while using Node APIs in edge runtime
  • Did not remove getServerSession() from pages/admin/* files, because it would fail to read env variables if removed

@github-actions github-actions bot added the issue linked Pull Request has issue linked label Oct 1, 2023
middleware.js Outdated Show resolved Hide resolved
middleware.js Outdated Show resolved Hide resolved
Copy link
Member

@eddiejaoude eddiejaoude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution 👍

I have added some inline comments

@bikrantjajware
Copy link
Contributor Author

Hello Eddie,
i think the all the comments are addressed now, let me know if you have any more suggestions.

@bikrantjajware
Copy link
Contributor Author

Hello @eddiejaoude,
just following up on this, do you have any comments :)

@eddiejaoude
Copy link
Member

Sorry for my delay, I will have a look soon. It looks like the automated tests are passing which is great 👍

Copy link
Member

@eddiejaoude eddiejaoude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

@eddiejaoude eddiejaoude changed the base branch from main to feat-middleware October 17, 2023 10:48
@eddiejaoude eddiejaoude merged commit 853cf0b into EddieHubCommunity:feat-middleware Oct 17, 2023
13 checks passed
@bikrantjajware
Copy link
Contributor Author

Thank you Eddie :)

eddiejaoude added a commit that referenced this pull request Oct 24, 2023
* feat: admin user check middleware (#9249)

* feat: admin check middleware

* fix review comments

* match /api/admin paths

---------

Co-authored-by: Eddie Jaoude <[email protected]>

* feat: authenticated pages protected

* fix: removed session checks from account pages

* test: home page stats #9384 (#9462)

* Update home.spec.js

* Update home.spec.js

* Update home.spec.js

* Update home.spec.js

* Update tests/home.spec.js

* Update tests/home.spec.js

---------

Co-authored-by: Eddie Jaoude <[email protected]>

* feat: sentry integration (#9187)

* chore(release): v2.76.0 [skip ci]

* fix: sentry disable cron (#9533)

* fix: sentry disable cron

* fix: test setup error var

* chore(release): v2.76.1 [skip ci]

* deploy to prevew

* fix: removed debug code

---------

Co-authored-by: Bikrant Jajware <[email protected]>
Co-authored-by: Ken Beaudin <[email protected]>
Co-authored-by: Conventional Changelog Action <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue linked Pull Request has issue linked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Middleware to project "admin" pages and api
2 participants